unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* quoted buffer object
@ 2007-08-23  9:48 Thien-Thi Nguyen
  2007-08-23 13:16 ` Johan Bockgård
  0 siblings, 1 reply; 3+ messages in thread
From: Thien-Thi Nguyen @ 2007-08-23  9:48 UTC (permalink / raw)
  To: emacs-devel

in vc.el:999, i see:

  (with-current-buffer ',(current-buffer)

weird.  here are some experiments in *scratch*:

  (bufferp (current-buffer))
  t
  
  (bufferp (car `(,(current-buffer))))
  t
  
  (bufferp (car `(',(current-buffer))))
  nil

i conclude the code as it stands does not DTRT.
perhaps it should be changed to:

  (with-current-buffer ,(buffer-name (current-buffer))

?  any objections?

thi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: quoted buffer object
  2007-08-23  9:48 quoted buffer object Thien-Thi Nguyen
@ 2007-08-23 13:16 ` Johan Bockgård
  2007-08-23 14:42   ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Bockgård @ 2007-08-23 13:16 UTC (permalink / raw)
  To: emacs-devel

Thien-Thi Nguyen <ttn@gnuvola.org> writes:

> in vc.el:999, i see:
>
>   (with-current-buffer ',(current-buffer)
>
> weird.  here are some experiments in *scratch*:
>
>   (bufferp (current-buffer))
>   t
>   
>   (bufferp (car `(,(current-buffer))))
>   t
>   
>   (bufferp (car `(',(current-buffer))))
>   nil
>
> i conclude the code as it stands does not DTRT.

But 'x *evaluates* to x, so the quote is harmless (though superfluous,
since buffer objects are self-evaluating).

  `(lambda ()
     (with-current-buffer ',(current-buffer) ...))

     =>  (lambda nil (with-current-buffer '#<buffer foo> ...))

which will DTRT.

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: quoted buffer object
  2007-08-23 13:16 ` Johan Bockgård
@ 2007-08-23 14:42   ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2007-08-23 14:42 UTC (permalink / raw)
  To: emacs-devel

> But 'x *evaluates* to x, so the quote is harmless (though superfluous,
> since buffer objects are self-evaluating).

Indeed, the quote can be optimized away, but I don't think it hurts either:
better safe than sorry.


        Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-23 14:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-23  9:48 quoted buffer object Thien-Thi Nguyen
2007-08-23 13:16 ` Johan Bockgård
2007-08-23 14:42   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).