emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <eric.schulte@gmx.com>
To: Andreas Leha <andreas.leha@med.uni-goettingen.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: flet / my-filt problem
Date: Mon, 30 Jul 2012 17:31:09 -0600	[thread overview]
Message-ID: <87hasoj076.fsf@gmx.com> (raw)
In-Reply-To: 87fw8898h0.fsf@med.uni-goettingen.de

[-- Attachment #1: Type: text/plain, Size: 1058 bytes --]

Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> Eric Schulte <eric.schulte@gmx.com> writes:
>
>> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>>
>>> Hi all,
>>>
>>> with the current HEAD (commit 0202adb1c02908a75a7845438381e40d811fd99a)
>>> from master I get an error during the export of
>>> one of my files complaining about an undefined my-filt function.
>>>
>>> Replacing org-flet with flet in ob-comint.el (line 78) introduces a
>>> compiler warning, but solves the problem.
>>>
>>> I am on emacs 24.1.50.1.
>>>
>>
>> Hi Andreas,
>>
>> Does replacing `org-flet' in line 78 of ob-comint.el with `org-labels'
>> solve this problem?
>>
>> Thanks,
>
> Hi Eric,
>
> thanks for the quick response.  But org-labels does not solve the
> problems for me.
>
> Backtrace is attached.  Don't know if this is interesting...
>

Ugh, I wish Emacs wouldn't replace an existing function with a new
function which not only has a different name, but also has different
functionality.

Does the attached patch resolve this bad behavior?

Thanks,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-let-instead-of-flet-so-function-name-may-be-used.patch --]
[-- Type: text/x-patch, Size: 3591 bytes --]

From 39e85dc85a4ba364302fee9319dbf50cb61e9ba7 Mon Sep 17 00:00:00 2001
From: Eric Schulte <eric.schulte@gmx.com>
Date: Mon, 30 Jul 2012 17:29:32 -0600
Subject: [PATCH] let* instead of flet so function name may be used

* lisp/ob-comint.el (org-babel-comint-with-output): Use let* instead of
  flet so function name may be used in a hook.
---
 lisp/ob-comint.el | 68 +++++++++++++++++++++++++++----------------------------
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el
index f7403dc..8a7dbc8 100644
--- a/lisp/ob-comint.el
+++ b/lisp/ob-comint.el
@@ -74,40 +74,40 @@ or user `keyboard-quit' during execution of body."
 	(remove-echo (cadr (cdr meta)))
 	(full-body (cadr (cdr (cdr meta)))))
     `(org-babel-comint-in-buffer ,buffer
-       (let ((string-buffer "") dangling-text raw)
-	 (org-flet ((my-filt (text)
-			 (setq string-buffer (concat string-buffer text))))
-	   ;; setup filter
-	   (add-hook 'comint-output-filter-functions 'my-filt)
-	   (unwind-protect
-	       (progn
-		 ;; got located, and save dangling text
-		 (goto-char (process-mark (get-buffer-process (current-buffer))))
-		 (let ((start (point))
-		       (end (point-max)))
-		   (setq dangling-text (buffer-substring start end))
-		   (delete-region start end))
-		 ;; pass FULL-BODY to process
-		 ,@body
-		 ;; wait for end-of-evaluation indicator
-		 (while (progn
-			  (goto-char comint-last-input-end)
-			  (not (save-excursion
-				 (and (re-search-forward
-				       (regexp-quote ,eoe-indicator) nil t)
-				      (re-search-forward
-				       comint-prompt-regexp nil t)))))
-		   (accept-process-output (get-buffer-process (current-buffer)))
-		   ;; thought the following this would allow async
-		   ;; background running, but I was wrong...
-		   ;; (run-with-timer .5 .5 'accept-process-output
-		   ;; 		 (get-buffer-process (current-buffer)))
-		   )
-		 ;; replace cut dangling text
-		 (goto-char (process-mark (get-buffer-process (current-buffer))))
-		 (insert dangling-text))
-	     ;; remove filter
-	     (remove-hook 'comint-output-filter-functions 'my-filt)))
+       (let* ((string-buffer "")
+	      (my-filt (lambda (text) (setq string-buffer (concat string-buffer text))))
+	      dangling-text raw)
+	 ;; setup filter
+	 (add-hook 'comint-output-filter-functions 'my-filt)
+	 (unwind-protect
+	     (progn
+	       ;; got located, and save dangling text
+	       (goto-char (process-mark (get-buffer-process (current-buffer))))
+	       (let ((start (point))
+		     (end (point-max)))
+		 (setq dangling-text (buffer-substring start end))
+		 (delete-region start end))
+	       ;; pass FULL-BODY to process
+	       ,@body
+	       ;; wait for end-of-evaluation indicator
+	       (while (progn
+			(goto-char comint-last-input-end)
+			(not (save-excursion
+			       (and (re-search-forward
+				     (regexp-quote ,eoe-indicator) nil t)
+				    (re-search-forward
+				     comint-prompt-regexp nil t)))))
+		 (accept-process-output (get-buffer-process (current-buffer)))
+		 ;; thought the following this would allow async
+		 ;; background running, but I was wrong...
+		 ;; (run-with-timer .5 .5 'accept-process-output
+		 ;; 		 (get-buffer-process (current-buffer)))
+		 )
+	       ;; replace cut dangling text
+	       (goto-char (process-mark (get-buffer-process (current-buffer))))
+	       (insert dangling-text))
+	   ;; remove filter
+	   (remove-hook 'comint-output-filter-functions 'my-filt))
 	 ;; remove echo'd FULL-BODY from input
 	 (if (and ,remove-echo ,full-body
 		  (string-match
-- 
1.7.11.3


[-- Attachment #3: Type: text/plain, Size: 46 bytes --]


-- 
Eric Schulte
http://cs.unm.edu/~eschulte

  reply	other threads:[~2012-07-30 23:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30 21:59 flet / my-filt problem Andreas Leha
2012-07-30 22:23 ` Eric Schulte
2012-07-30 22:42   ` Andreas Leha
2012-07-30 23:31     ` Eric Schulte [this message]
2012-07-31  7:52       ` Andreas Leha
2012-07-31  8:05       ` Bastien
2012-07-31 14:20         ` Eric Schulte
2012-07-31 15:17           ` Bastien
2012-08-01 21:57             ` Andreas Leha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hasoj076.fsf@gmx.com \
    --to=eric.schulte@gmx.com \
    --cc=andreas.leha@med.uni-goettingen.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).