From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Gerard Brunick Newsgroups: gmane.emacs.bugs Subject: bug#14662: 24.3.50; add-function problem Date: Tue, 18 Jun 2013 21:27:17 -0700 Message-ID: <51C13325.3030503@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1371623195 6078 80.91.229.3 (19 Jun 2013 06:26:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Jun 2013 06:26:35 +0000 (UTC) To: 14662@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 19 08:26:36 2013 Return-path: Envelope-to: geb-bug-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 1UpBqk-0000Mw-Am for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Jun 2013 08:26:34 +0200 Original-Received: from localhost ([::1]:47016 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpBqj-00046M-RK for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Jun 2013 02:26:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpBqW-000466-6Q for bug-gnu-emacs@gnu.org; Wed, 19 Jun 2013 02:26:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UpBqO-00015n-Fa for bug-gnu-emacs@gnu.org; Wed, 19 Jun 2013 02:26:20 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UpBqO-00015j-AX for bug-gnu-emacs@gnu.org; Wed, 19 Jun 2013 02:26:12 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1UpBqL-0005TC-6Z for bug-gnu-emacs@gnu.org; Wed, 19 Jun 2013 02:26:10 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gerard Brunick Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Jun 2013 06:26:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14662 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.137162315621003 (code B ref -1); Wed, 19 Jun 2013 06:26:04 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Jun 2013 06:25:56 +0000 Original-Received: from localhost ([127.0.0.1]:54499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UpBq4-0005SV-7Z for submit@debbugs.gnu.org; Wed, 19 Jun 2013 02:25:54 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56914) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Up9zb-0001XK-E3 for submit@debbugs.gnu.org; Wed, 19 Jun 2013 00:27:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Up9zT-0001Ja-CE for submit@debbugs.gnu.org; Wed, 19 Jun 2013 00:27:30 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:37119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Up9zT-0001JW-8m for submit@debbugs.gnu.org; Wed, 19 Jun 2013 00:27:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Up9zQ-0006Vz-Db for bug-gnu-emacs@gnu.org; Wed, 19 Jun 2013 00:27:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Up9zM-0001J8-PB for bug-gnu-emacs@gnu.org; Wed, 19 Jun 2013 00:27:24 -0400 Original-Received: from mail-yh0-x231.google.com ([2607:f8b0:4002:c01::231]:63567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Up9zM-0001J4-KS for bug-gnu-emacs@gnu.org; Wed, 19 Jun 2013 00:27:20 -0400 Original-Received: by mail-yh0-f49.google.com with SMTP id v1so1929590yhn.36 for ; Tue, 18 Jun 2013 21:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=G0hG5IWro7jDseEF96rEZChH0Cy6j+x54qkjivG2/ss=; b=o2s3tkCvD9j5aVJdgGyIv7VGxD5ul+8zxviCjl6J56HV5oV6vifqTxeINYTSd3ozZ+ AzLCMP0guPtByfx8vbqkfKGajRkrSDqRx/FkCf9TVTaaEj//NIb+JlSZOuYy4AMDBzNP XPCQ8CIQMzrR/7lPr9RzpPSJ4VvxfoNHKo06wybj8LgKcHQZddX+wndB6lMgCFtyWwGl owEvJIkkY/Zh+b1PpiBBhtmibl5wTeYuP6cea8cS/UnPVyqGymGOzct1gRglgMxzbYMD gHgIWaYOqgdmF3olIDItMSkBkxxO/chCnfn+o/vxb6lnoZyahl0++ZpQ/zopGZ8Wfuy4 8VaQ== X-Received: by 10.236.126.47 with SMTP id a35mr615360yhi.45.1371616039909; Tue, 18 Jun 2013 21:27:19 -0700 (PDT) Original-Received: from [192.168.1.103] (ip184-189-246-15.sb.sd.cox.net. [184.189.246.15]) by mx.google.com with ESMTPSA id y70sm35141609yhe.15.2013.06.18.21.27.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Jun 2013 21:27:19 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Wed, 19 Jun 2013 02:25:48 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:75326 Archived-At: There seems to be a problem with add-function: 1. emacs -Q 2. M-x run-python 3. Eval "(comint-redirect-send-command-to-process "print 'test'" "test" "*Python*" t)" and observe that there are no errors. 4. Copy the text of comint-redirect-send-command-to-process from comint.el to the scratch buffer, and eval-defun it. 5. Now eval "(comint-redirect-send-command-to-process "print 'test'" "test" "*Python*" t)" again and suddenly I get: Debugger entered--Lisp error: (void-variable v) (process-filter v) (lambda nil (process-filter v))() advice--add-function(:around ((lambda nil (process-filter v)) lambda (gv--val) (set-process-filter v gv--val)) comint-redirect-filter nil) (save-current-buffer (set-buffer process-buffer) (and comint-redirect-perform-sanity-check (save-excursion (goto-char (point-max)) (or (re-search-backward comint-prompt-regexp nil t) (error "No prompt found or `comint-prompt-regexp' not set properly")))) (comint-redirect-setup output-buffer (current-buffer) comint-prompt-regexp echo) (advice--add-function :around (let* ((v proc)) (cons (function (lambda nil (process-filter v))) (function (lambda (gv--val) (set-process-filter v gv--val))))) (function comint-redirect-filter) nil) (process-send-string (current-buffer) (concat command "\n")) (or no-display (display-buffer (get-buffer-create (if (listp output-buffer) (car output-buffer) output-buffer))))) (let* ((process-buffer (if (processp process) (process-buffer process) process)) (proc (get-buffer-process process-buffer))) (save-current-buffer (set-buffer process-buffer) (and comint-redirect-perform-sanity-check (save-excursion (goto-char (point-max)) (or (re-search-backward comint-prompt-regexp nil t) (error "No prompt found or `comint-prompt-regexp' not set properly")))) (comint-redirect-setup output-buffer (current-buffer) comint-prompt-regexp echo) (advice--add-function :around (let* ((v proc)) (cons (function (lambda nil (process-filter v))) (function (lambda (gv--val) (set-process-filter v gv--val))))) (function comint-redirect-filter) nil) (process-send-string (current-buffer) (concat command "\n")) (or no-display (display-buffer (get-buffer-create (if (listp output-buffer) (car output-buffer) output-buffer)))))) comint-redirect-send-command-to-process("print 'test'" "test" "*Python*" t) eval((comint-redirect-send-command-to-process "print 'test'" "test" "*Python*" t) nil) eval-last-sexp-1(nil) eval-last-sexp(nil) call-interactively(eval-last-sexp nil nil) command-execute(eval-last-sexp) If I omit step 4 and eval-defun the code right in comint.el, I don't see this behaviour. I assume that the emacs notices nothing has changed and ignores the eval-defun. This is somehow related to the compile-time macro expansion in add-function. Other configuration info follows: In GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2) of 2013-06-11 on papaya, modified by Debian (emacs-snapshot package, version 2:20130611-1~ppa1~precise1) Windowing system distributor `The X.Org Foundation', version 11.0.11103000 System Description: Ubuntu 12.04.2 LTS Configured using: `configure --build x86_64-linux-gnu --host x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.3.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3.50/site-lisp:/usr/share/emacs/site-lisp --without-compress-info --with-crt-dir=/usr/lib/x86_64-linux-gnu/ --with-x=yes --with-x-toolkit=gtk3 --with-imagemagick=yes CFLAGS='-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' CPPFLAGS='-D_FORTIFY_SOURCE=2' LDFLAGS='-g -Wl,--as-needed -znocombreloc'' Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: eldoc-mode: t tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: i * * C-e C-x e C-x C-e q C-x o C-x b C-k q C-g C-x o h C-h C-h q P C-e C-x C-e C-x o C-x b C-M-. C-u C-S-x C-M-x C-x o C-x e C-x C-e C-x C-e C-x o C-x b M-w C-x o C-v C-y k C-M-x C-x e C-x C-e q C-x o C-x 0 M-x b u g - r e p o r e p o r Recent messages: kmacro-call-macro: No kbd macro has been defined # [2 times] Mark set Saved text from "(defun comint-redirect-send-command-to-p" scroll-up-command: End of buffer Mark set comint-redirect-send-command-to-process kmacro-call-macro: No kbd macro has been defined Entering debugger... Back to top level. Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils gv etags nadvice kmacro debug eldoc jka-compr find-func help-mode help-fns compile python rx easymenu comint ring ansi-color time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) Cheers, Gerard