bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9438: grep regressions


From: Juri Linkov
Subject: bug#9438: grep regressions
Date: Wed, 07 Sep 2011 15:09:24 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu)

>> +    (when grep-highlight-matches
>> +      (setq compilation-error-screen-columns nil)
>
> Why set it here?  I know it used to be set similarly, but I think it
> should be set once and for all in grep-mode instead.

I just discovered `grep-error-screen-columns', a defcustom
added in 2004.  Its default value is nil, so I suppose
its purpose was to override `compilation-error-screen-columns'.
It's currently unused because it misses the following lines
in `grep-mode':

  (set (make-local-variable 'compilation-error-screen-columns)
       grep-error-screen-columns)

I added that to `grep-mode'.

> Or better yet:
>
>          (let* ((beg (match-end 0))
>                 (end (save-excursion (goto-char beg) (line-end-position)))

Yes, this is better.  I installed these changes.

Beside `grep-error-screen-columns', I discovered two more unused defcustoms
in grep.el:

  (defcustom grep-window-height nil
    "*Number of lines in a grep window.  If nil, use 
`compilation-window-height'."
    :type '(choice (const :tag "Default" nil)
                   integer)
    :version "22.1"
    :group 'grep)

  (defcustom grep-scroll-output nil
    "*Non-nil to scroll the *grep* buffer window as output appears.
  Setting it causes the grep commands to put point at the end of their
  output window so that the end of the output is always visible rather
  than the begining."
    :type 'boolean
    :version "22.1"
    :group 'grep)

IIUC, since the docstring says "If nil, use `compilation-window-height'"
they should be used in `grep-mode' only when the value is non-nil like:

  (when grep-window-height
    (set (make-local-variable 'compilation-window-height)
         grep-window-height))
  (when grep-scroll-output
    (set (make-local-variable 'compilation-scroll-output)
         grep-scroll-output))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]