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: Re: Line number where eval-after-load is defined in my .emacs file Date: Wed, 13 Nov 2013 22:03:12 +0100 Organization: Sebastien Vauban Message-ID: <86mwl8m2un.fsf@somewhere.org> References: <86mwl88d9a.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1384376716 20684 80.91.229.3 (13 Nov 2013 21:05:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Nov 2013 21:05:16 +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 22:05:19 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 1Vghck-0001by-W3 for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Nov 2013 22:05:19 +0100 Original-Received: from localhost ([::1]:50797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vghck-00079w-GC for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Nov 2013 16:05:18 -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: 42 Injection-Info: mx05.eternal-september.org; posting-host="6f05eaee171434c896d44feeaf7179f0"; logging-data="22591"; mail-complaints-to="abuse-VVbKFVtnif8H+i2N2EyTrmui9UKz+5OX@public.gmane.org"; posting-account="U2FsdGVkX1/mji87yuib+9m0Iu41lvff" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) X-Archive: encrypt Cancel-Lock: sha1:0voGaaGG81udlUaI4CykTB0A9UM= sha1:E80N9lojqOc2EdyfvITbjQILsng= X-Url: Under construction... Original-Xref: usenet.stanford.edu gnu.emacs.help:202214 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:94483 Archived-At: Hello, "Sebastien Vauban" wrote: > 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: > > ;; 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 ">>>")))) > > It works well, except that line is always displayed as `1' in the Messages > buffer. I tried using the more "standard" function (defined in simple.el) `line-number-at-pos', but that gives the same problem. > 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? I'm sure what I ask (to access/save the line number of where the macro is called) is possible, but there's something I clearly miss in the macro stuff... Best regards, Seb -- Sebastien Vauban