From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Sebastien Vauban" Newsgroups: gmane.emacs.help Subject: Line number where eval-after-load is defined in my .emacs file Date: Wed, 13 Nov 2013 17:42:09 +0100 Organization: Sebastien Vauban Message-ID: <86mwl88d9a.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1384361115 20547 80.91.229.3 (13 Nov 2013 16:45:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Nov 2013 16:45:15 +0000 (UTC) To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Wed Nov 13 17:45:20 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VgdZ9-0003iB-CY for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Nov 2013 17:45:19 +0100 Original-Received: from localhost ([::1]:49639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgdZ8-0005PN-WE for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Nov 2013 11:45:19 -0500 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 57 Injection-Info: mx05.eternal-september.org; posting-host="402b34550bd938aa98825778083dce0e"; logging-data="19170"; mail-complaints-to="abuse-VVbKFVtnif8H+i2N2EyTrmui9UKz+5OX@public.gmane.org"; posting-account="U2FsdGVkX1/874XmbjOuOexPKH2pVHHq" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) X-Url: Under construction... X-Archive: encrypt Cancel-Lock: sha1:sQtvXYqlyGvLlZlchpKpu/WMWSc= sha1:E5bPxmrdsRVpVAoVtheEs5R3yTQ= Original-Xref: usenet.stanford.edu gnu.emacs.help:202209 X-BeenThere: help-gnu-emacs-mXXj517/zsQ@public.gmane.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Xref: news.gmane.org gmane.emacs.help:94478 Archived-At: Hello, As I do (sometimes) have -- for the same library -- multiple "eval-after-load" blocks of code at different spots of my .emacs file, I'd like to be able to identify which one was called at which point when reading the Messages buffer. To do so, I tried to (re-)define `with-eval-after-load' such as: --8<---------------cut here---------------start------------->8--- ;; wrapper around `eval-after-load' (defmacro with-eval-after-load (mode &rest body) "`eval-after-load' MODE evaluate BODY." (declare (indent defun)) `(eval-after-load ,mode '(progn (message "<<< Running code block specific to library `%s' (at line %d)..." ,mode ,(org-current-line)) ; [1] ,@body (message ">>>")))) --8<---------------cut here---------------end--------------->8--- I'd like to see: --8<---------------cut here---------------start------------->8--- <<< Running code block specific to library `org' (at line 123)... ... >>> <<< Running code block specific to library `org' (at line 567)... ... >>> --8<---------------cut here---------------end--------------->8--- It works well, except that line is always displayed as `1' in the Messages buffer. Is there a way to "link" the messages to the `eval-after-load' blocks in my .emacs file by showing the line number where those blocks are defined? Or is there some other way to get such more or less the same type of information? Best regards, Seb [1] The code for org-current-line is: --8<---------------cut here---------------start------------->8--- (defsubst org-current-line (&optional pos) (save-excursion (and pos (goto-char pos)) ;; works also in narrowed buffer, because we start at 1, not point-min (+ (if (bolp) 1 0) (count-lines 1 (point))))) --8<---------------cut here---------------end--------------->8--- -- Sebastien Vauban