all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Line number where eval-after-load is defined in my .emacs file
@ 2013-11-13 16:42 Sebastien Vauban
  2013-11-13 17:05 ` William G. Gardella
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Sebastien Vauban @ 2013-11-13 16:42 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

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


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

end of thread, other threads:[~2013-11-22 16:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13 16:42 Line number where eval-after-load is defined in my .emacs file Sebastien Vauban
2013-11-13 17:05 ` William G. Gardella
     [not found] ` <mailman.5986.1384362332.10748.help-gnu-emacs@gnu.org>
2013-11-13 20:12   ` Sebastien Vauban
2013-11-14  8:19     ` Thien-Thi Nguyen
     [not found]     ` <mailman.6043.1384418405.10748.help-gnu-emacs@gnu.org>
2013-11-15 13:43       ` Sebastien Vauban
2013-11-16  1:40         ` Michael Heerdegen
2013-11-13 21:03 ` Sebastien Vauban
2013-11-13 22:09   ` Stefan Monnier
2013-11-13 23:26 ` Michael Heerdegen
     [not found] ` <mailman.6018.1384385233.10748.help-gnu-emacs@gnu.org>
2013-11-15 13:46   ` Sebastien Vauban
2013-11-22 16:47 ` jack-mac

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.