Article View: gnu.emacs.bug
Article #98955backquote can side-effect its argument
From: Carl Witty
Date: Thu, 17 Jan 1991 07:15
Date: Thu, 17 Jan 1991 07:15
42 lines
1769 bytes
1769 bytes
GNU Emacs 18.55.18 of Thu Mar 29 1990 on shelby.Stanford.EDU (berkeley-unix) The backquote (`) function can sometimes modify its argument. Here is an example: (defun foo () (\` (progn (\, nil) (\,@ (list))))) => foo (symbol-function 'foo) => (lambda nil (\` (progn (\, nil) (\,@ (list))))) (foo) => (progn nil) (symbol-function 'foo) => (lambda nil (\` (progn (\, nil) (\,@ (list nil))))) (foo) => (progn nil nil) The problem is with a rplacd in the function bq-evalappend; replacing that function with the following definition: (defun bq-evalappend (form) (cond ((and (listp tailmaker) (listp (car tailmaker)) (eq (bq-caar tailmaker) 'list)) (setq tailmaker (cons (cons (car (car tailmaker)) (cons form (bq-cdar tailmaker))) (cdr tailmaker))) ; (rplacd (car tailmaker) ; (cons form (bq-cdar tailmaker))) ) ((= (length tailmaker) 1) (setq tailmaker (cons form tailmaker)) (setq state 'cons)) (t (bq-push (list 'list form) tailmaker)))) (replacing the rplacd with a setq which builds a new list) seems to solve the problem. Carl Witty cwitty@cs.stanford.edu
Technical Details
Message-ID:
<9101170815.AA02627@jessica.stanford.edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!att!tut.cis.ohio-state.edu!JESSICA.STANFORD.EDU!cwittyShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,6ca8c7306a64e24e,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1991-01-16 23:15:13 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!att!tut.cis.ohio-state.edu!JESSICA.STANFORD.EDU!cwitty From: cwitty@JESSICA.STANFORD.EDU (Carl Witty) Newsgroups: gnu.emacs.bug Subject: backquote can side-effect its argument Message-ID: <9101170815.AA02627@jessica.stanford.edu> Date: 17 Jan 91 07:15:13 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 42 Approved: bug-gnu-emacs@prep.ai.mit.edu