all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* display-buffer and save-current-buffer
@ 2015-07-26 15:47 Ian Zimmerman
  2015-07-26 16:26 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Zimmerman @ 2015-07-26 15:47 UTC (permalink / raw)
  To: help-gnu-emacs

I was trying todo-mode ie. lisp/calendar/todo-mode.el in the emacs
distribution.  In the todo mode buffer I hit "t" which is bound to
todo-top-priorities.

Here is a bit of the code:

    (save-excursion
      (todo-show)
      (save-restriction
        (save-current-buffer
          (widen)
          (copy-to-buffer todo-print-buffer-name (point-min) (point-max))
          (set-buffer todo-print-buffer-name)

          (too-much-junk-to-not-elide)

      )))
    (when interactive (display-buffer todo-print-buffer-name))
    (message "Type C-x 1 to remove %s window.  M-C-v to scroll the help."
             todo-print-buffer-name)

Clearly, the intention is to show the buffer which was temporarily
selected within the save-current-buffer form.  However no such thing
happens; I get the message (with the expected buffer name interpolated)
but the buffer is not shown, I'm still in the original window
configuration with a single window showing the todo buffer.

When I do M-x eval-expression (display-buffer todo-print-buffer-name)
afterwards, it works as expected.

Is there perhaps a known bug with the interaction of save-current-buffer
and display-buffer in emacs 23.4 ?
      
-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




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

* Re: display-buffer and save-current-buffer
  2015-07-26 15:47 display-buffer and save-current-buffer Ian Zimmerman
@ 2015-07-26 16:26 ` Stefan Monnier
  2015-07-26 16:45   ` Ian Zimmerman
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2015-07-26 16:26 UTC (permalink / raw)
  To: help-gnu-emacs

>     (save-excursion
>       (todo-show)

This looks fishy.

>       (save-restriction
>         (save-current-buffer

This looks even more fishy.

>           (widen)
>           (copy-to-buffer todo-print-buffer-name (point-min) (point-max))

Clearly these two lines should go before save-current-buffer (since
they don't affect current-buffer).

>           (set-buffer todo-print-buffer-name)

After moving those two lines, this set-buffer can be combined with
save-current-buffer into with-current-buffer.

> Clearly, the intention is to show the buffer which was temporarily
> selected within the save-current-buffer form.  However no such thing
> happens;

Could it be that `interactive' is nil?

> Is there perhaps a known bug with the interaction of save-current-buffer
> and display-buffer in emacs 23.4 ?
      
No.  And the above fishiness should have no impact either.


        Stefan




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

* Re: display-buffer and save-current-buffer
  2015-07-26 16:26 ` Stefan Monnier
@ 2015-07-26 16:45   ` Ian Zimmerman
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Zimmerman @ 2015-07-26 16:45 UTC (permalink / raw)
  To: help-gnu-emacs

On 2015-07-26 12:26 -0400, Stefan Monnier wrote:

> Could it be that `interactive' is nil?

Indeed it is, thanks.  This function makes no sense; it is marked
interactive, and a keybinding exists for it, but it only behaves right
as a command when an optional arg is non-nil.

Makes my question in the other thread all the more urgent :-)

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.




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

end of thread, other threads:[~2015-07-26 16:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-26 15:47 display-buffer and save-current-buffer Ian Zimmerman
2015-07-26 16:26 ` Stefan Monnier
2015-07-26 16:45   ` Ian Zimmerman

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.