나는 emacs로 시작하고 있으며 많은 elisp을 모른다. 거의 아무것도, 정말로.elisp 컴파일, 오류 검출에 regexp를 추가하십시오.
grep 대신 ack를 사용하고 싶습니다.
이 내가 이맥스 내에서 ACK를 사용하는 다음의 지침은 다음과 같습니다 지금이 엘 파일에 사용되는 출력 형식을 좋아하지 않아 http://www.rooijan.za.net/?q=ack_el
가, 나는 ack --group
의를로 출력을하고 싶습니다 .
(read-string "Ack arguments: " "-i" nil "-i" nil)
에 :
(read-string "Ack arguments: " "-i --group" nil "-i --group" nil)
지금까지 너무 좋아. 하지만이 때문에 출력 버퍼 행에서 click-press_enter를 사용할 수 없게되었습니다. 원래의 동작에서는 컴파일 된 모드를 사용하여 선택한 행으로 이동할 수있었습니다.
나는 내가 ACK 모드에 정규 표현식을 추가해야합니다 생각. 는 ACK 모드는 다음과 같이 정의된다 :(define-compilation-mode ack-mode "Ack"
"Specialization of compilation-mode for use with ack."
nil)
그리고 그것이 출력 놈의 모든 행 (행 번호)가 포함되어 무엇 때문에, 너무 오류로 감지 할 수있는 정규 표현식 [0-9]+:
를 추가 할.
위의 define-compilation-mode
을 수정하여 정규 표현식을 추가하려고했지만 비참하게 실패했습니다.
ack
의 출력 버퍼를 어떻게 만들 수 있습니까? ---
(defvar ack-regexp-alist
'(("[0-9]+:"
2 3))
"Alist that specifies how to match rows in ack output.")
(setq compilation-error-regexp-alist
(append compilation-error-regexp-alist
ack-regexp-alist))
내가 그 곳 훔쳐 내 요구에 적응하기 위해 노력 :
--- 편집, 나 또한 노력했다. 불운. 업데이트 ack.el와
--- 편집, 이반의 제안 후 결과 ---
가 포함 :
(defvar ack-regexp-alist
'(("^[0-9]+:" ;; match the line number
nil ;; the file is not found on this line, so assume that it's the same as before
0 ;; The line is the 0'th subexpression (the whole thing)
)
("^[^: ]+$" ;; match a file -- this could be better
0 ;; The file is the 0'th subexpression
))
"Alist that specifies how to match rows in ack output.")
(setq compilation-error-regexp-alist
(append compilation-error-regexp-alist
ack-regexp-alist))
(define-compilation-mode ack-mode "Ack"
"Specialization of compilation-mode for use with ack."
nil)
는 그 다음 compilation-error-regext-alist
변수를 확인, 내가 가치를 얻을 : (absoft ada aix ant bash borland caml comma edg-1 edg-2 epc ftnchek iar ibm irix java jikes-file jikes-line gnu gcc-include lcc makepp mips-1 mips-2 msft oracle perl rxp sparc-pascal-file sparc-pascal-line sparc-pascal-example sun sun-ada 4bsd gcov-file gcov-header gcov-nomark gcov-called-line gcov-never-called
("^[0-9]+:" nil 0)
("^[^: ]+$" 0))
나는 그것은 매우 이상한 변수의 형식을하지 않습니다 찾을? 나는 elisp (아직)를 모른다. 그래서 아마 그렇게 될 것이다.
여전히 * ack * 버퍼에 링크 또는 색이 없습니다.
알리미 정의에 도움을 주셔서 감사합니다. 그러나, 나는 아직도 그것을 컴파일 명령에 전달하는 방법에 대해 확신하지 못하고있다. 는 출력은 현재 내가 비록'(SETQ 컴파일 오류 - 정규 표현식-alist (컴파일 오류 - 정규 표현식-alist ACK-정규 표현식-alist)를 추가)는 'ACK-정규 표현식 - alist'에 관심을 보인다 ' – Gauthier
'Mx compile '을 사용하여 수동으로 실행하면 저에게 효과적입니다. (regexp 파일은 제대로 작동하지 않지만). 한 가지해야 할 일은 ack-regexp-alist가 업데이트되고 있는지 확인하는 것입니다. 'defvar'를 여러 번 평가하면 일단 설정되면 값이 변경되지 않습니다. 'C-h v ack-regexp-alist RET'는'ack-regexp-alist'의 현재 값을 보여줍니다. 'compilation-error-regexp-alist'와 마찬가지로. –
다시 한번 감사드립니다. 나는 아직도 혼란 스럽다. 나는 내 질문을 편집하여 내가 제안한 후에 내가 갇혀있는 곳을 보여 준다. – Gauthier