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

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

bug#13549: 24.3.50; FR: Improve grep output (show function names, when p


From: Jambunathan K
Subject: bug#13549: 24.3.50; FR: Improve grep output (show function names, when possible)
Date: Sun, 03 Feb 2013 19:19:05 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Jambunathan K <kjambunathan@gmail.com> writes:

> I used the following local modification to compile.el to sneak in the
> function names.  
>
> The modification is in `compilation-parse-errors' which seems to be a
> font-lock handler.  I call `which-function' within this context.  Is it
> justified?
>
> (WARNING: Quick and Dirty work)
> (Bzr version: revno: 111597)

I attached the wrong diff (but the right screenshot).  I am attaching
the "right" diff, more for archival purposes.

Here is the diff that needs to be used.  Earlier diff was "totally
broken" in that it missed:

    1. `string-to-number' on line numbers.
    2. Goto beginning of buffer, before `forward-line'.

The changes still need a `save-excursion', though.  For experimental
code, it shouldn't matter much.

=== modified file 'lisp/progmodes/compile.el'
--- lisp/progmodes/compile.el   2013-02-02 08:41:02 +0000
+++ lisp/progmodes/compile.el   2013-02-03 13:35:20 +0000
@@ -1318,6 +1318,24 @@ to `compilation-error-regexp-alist' if R
                              file line end-line col end-col (or type 2) fmt))
 
             (when (integerp file)
+             (when (integerp line)
+               (let* ((file-name (match-string file))
+                      (line-no (string-to-number (match-string line)))
+                      (which-fn
+                       (save-match-data
+                         (with-current-buffer
+                             (find-file-noselect file-name)
+                           (goto-char (point-min))
+                           (forward-line (1- line-no))
+                           (which-function)))))
+                 (overlay-put
+                  (make-overlay (match-end file) (match-end file)
+                                (current-buffer) t t)
+                  'after-string
+                  (format "(%s)"
+                          (propertize (or which-fn "global")
+                                      'face 'cscope-function-face)))))
+
               (compilation--put-prop
                file 'font-lock-face
                (if (consp type)


-- 

reply via email to

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