|
From: | akrl |
Subject: | Re: function call location |
Date: | Tue, 22 May 2018 21:28:15 +0000 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/25.3 (berkeley-unix) |
For now the only solution I've found is to mimic how I would have done it in C. So I instrument my functions like: (defun f1 (line) (message (concat "f1 called at line " (int-to-string line)))) And I call it like: (f1 __line__) Instead of evaluating in the original buffer I use this expand-and-eval-buffer: (defun expand-line-n () (progn (goto-char 0) (while (search-forward "__line__" nil t) (replace-match (int-to-string (line-number-at-pos)))))) (defun expand-and-eval-buffer () (interactive) (let ((orig-buffer (current-buffer))) (with-temp-buffer (insert-buffer-substring orig-buffer) (expand-line-n) (eval-buffer)))) I'm wondering if there's a better way in order to the preprocessor approach. Bests akrl -- akrl@sdf.org SDF Public Access UNIX System - https://sdf.org
[Prev in Thread] | Current Thread | [Next in Thread] |