From: Jambunathan K <kjambunathan@gmail.com>
To: 13549@debbugs.gnu.org
Subject: bug#13549: 24.3.50; FR: Improve grep output (show function names, when possible)
Date: Fri, 25 Jan 2013 20:27:29 +0530 [thread overview]
Message-ID: <87a9rxux7q.fsf@gmail.com> (raw)
[-- 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 --]
next reply other threads:[~2013-01-25 14:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 14:57 Jambunathan K [this message]
2013-01-25 15:05 ` bug#13549: 24.3.50; FR: Improve grep output (show function names, when possible) 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a9rxux7q.fsf@gmail.com \
--to=kjambunathan@gmail.com \
--cc=13549@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).