Grepni qanday qilib qayta chaqiraman yoki keyingi xatolarga derazani derazadan

Grep yoki derleme oynasida keyingi xato da, men shunga o'xshash biror narsani ishlatishim mumkin

(setq next-error-recenter 35)

to ensure that window displaying the match scrolls to show the whole match, as described in more detail in this stackoverflow question.

Men grep yoki derazadan deraza oynasida xuddi shu narsani qanday bajaraman? Ko'pincha grep chiqishi yoki derazaning pastki qismidan chiqadigan derazalarni ishlab chiqaman va kunning barcha vaqtini grep chiqishi yoki xatolarni kompilyatsiya qilish uchun sarflayman, derazalar o'rtasida oldinga va orqaga o'tish muhim xarajatlarga qo'shiladi.

5
derleme-goto-locus ga qarashni va agar kerak bo'lsa, recenter komandasiga qo'yishni istaysizmi - izoh bilan boshlangan bo'limda: Agar kompilyatsiya buferi oynasi tanlangan. . . , Siz oynaning turli joylarida qayta qo'ng'iroq qilishingiz mumkin - recenter uchun doc-string-ga qarang.
qo'shib qo'ydi muallif lawlist, manba

1 javoblar

derleme/grep bufferida nuqta </​​code> manzilini to'liq saqlash uchun bunday vaqtinchalik echimdan foydalanaman:

(defun eab/compile-goto-error ()
  (interactive)
  (let ((istc? truncate-lines))
    (toggle-truncate-lines t)
    (let ((buf (current-buffer))
          (line (- (count-lines (window-start) (point))
                   (if (eq (point) (point-at-bol)) 0 1)))
          (point (point)))
      (compile-goto-error)
      (run-with-timer 0.01 nil `(lambda ()
                                 (let ((cb (current-buffer)))
                                       (pop-to-buffer ,buf)
                                       (recenter ,line)
                                       (goto-char ,point)
                                       (toggle-truncate-lines ,istc?)
                                       (pop-to-buffer cb)))))))

Agar derleme/grep bufetida nuqta </​​code> ning oddiy markazlashtirilishini istasangiz, quyidagilarni foydalaning:

(defun eab/next-error ()
  (interactive)
  (let ((buf (current-buffer)))
    (next-error)
    (run-with-timer 0.01 nil `(lambda ()
                             (let ((cb (current-buffer)))
                               (pop-to-buffer ,buf)
                               (recenter)
                               (pop-to-buffer cb))))))

Birinchi misolda derleme-goto-error o'rniga keyingi xato dan foydalanishingiz mumkin.

Yangilanish. Emacs 25.1 nolga teng bo'lmagan davr uchun talab qilinadi.

1
qo'shib qo'ydi