From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: akrl Newsgroups: gmane.emacs.help Subject: Re: function call location Date: Tue, 22 May 2018 21:28:15 +0000 Organization: SDF Public Access UNIX System, Est. 1987 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1527024801 5909 195.159.176.226 (22 May 2018 21:33:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 22 May 2018 21:33:21 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (berkeley-unix) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 22 23:33:17 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fLEuD-0001QS-IA for geh-help-gnu-emacs@m.gmane.org; Tue, 22 May 2018 23:33:17 +0200 Original-Received: from localhost ([::1]:58024 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fLEwJ-00057q-2V for geh-help-gnu-emacs@m.gmane.org; Tue, 22 May 2018 17:35:27 -0400 Original-Path: usenet.stanford.edu!goblin1!goblin3!goblin.stu.neva.ru!odin.sdf-eu.org!.POSTED.sdf.lonestar.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Injection-Info: odin.sdf-eu.org; posting-host="sdf.lonestar.org:205.166.94.15"; logging-data="23824"; mail-complaints-to="usenet@odin.sdf-eu.org" Cancel-Lock: sha1:j+DHphIdycmlAfs+XVwCQDnro5U= Original-Xref: usenet.stanford.edu gnu.emacs.help:222699 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116820 Archived-At: 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