unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
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: Sun, 03 Feb 2013 19:19:05 +0530	[thread overview]
Message-ID: <87zjzlh5im.fsf@gmail.com> (raw)
In-Reply-To: <87a9rxux7q.fsf@gmail.com> (Jambunathan K.'s message of "Fri, 25 Jan 2013 20:27:29 +0530")

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

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.


[-- Attachment #2: Type: text/plain, Size: 1014 bytes --]

=== 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)


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



-- 

  parent reply	other threads:[~2013-02-03 13:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=87zjzlh5im.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).