unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13549: 24.3.50; FR: Improve grep output (show function names, when possible)
@ 2013-01-25 14:57 Jambunathan K
  2013-01-25 15:05 ` Jambunathan K
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Jambunathan K @ 2013-01-25 14:57 UTC (permalink / raw)
  To: 13549

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]


FR: Improve grep output (show function names, when possible)


Please see the attached screen shot.

Window on top displays cscope control buffer.

Window down below shows output from rgrep.  Note that the grep output
has been enhanced to *also* display the function name.

Compare cscope's typography with grep's.  (Hint: cscope's is much
better).  I have modified compilation faces as below for quick visual
comparison.

(custom-set-faces
 '(compilation-info ((t (:inherit cscope-file-face))))
 '(compilation-line-number ((t (:inherit cscope-line-number-face)))))

----------------------------------------------------------------

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)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: compile.el.diff --]
[-- Type: text/x-diff, Size: 983 bytes --]

=== modified file 'lisp/progmodes/compile.el'
--- lisp/progmodes/compile.el	2013-01-14 01:09:38 +0000
+++ lisp/progmodes/compile.el	2013-01-25 14:25:11 +0000
@@ -1320,6 +1320,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 (match-string line))
+		       (which-fn
+			(save-match-data
+			  (when line-no
+			    (with-current-buffer
+				(find-file-noselect file-name)
+			      (forward-line (1- line))
+			      (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)


[-- Attachment #3: Type: text/plain, Size: 441 bytes --]


----------------------------------------------------------------

In GNU Emacs 24.3.50.7 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2013-01-25 on debian-6.05
Bzr revision: 111597 michael.albinus@gmx.de-20130124095002-l3domdlb4dqep93i
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
System Description:	Debian GNU/Linux 6.0.5 (squeeze)

----------------------------------------------------------------


[-- Attachment #4: grep-proof-of-concept-cf-cscope.png --]
[-- Type: image/png, Size: 62190 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-05-25 13:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-25 14:57 bug#13549: 24.3.50; FR: Improve grep output (show function names, when possible) Jambunathan K
2013-01-25 15:05 ` Jambunathan K
2013-01-25 17:32 ` Glenn Morris
2013-01-25 18:55 ` Stefan Monnier
2013-02-03 13:49 ` Jambunathan K
2013-05-22 20:44 ` Juri Linkov
2013-05-22 22:03   ` Stefan Monnier
2013-05-24 20:55     ` Juri Linkov
2013-05-25 13:08       ` Jambunathan K

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).