unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16882: 24.3.50; with-temp-buffer-window broken
@ 2014-02-25 18:40 Thierry Volpiatto
  2014-02-25 19:00 ` Glenn Morris
  0 siblings, 1 reply; 10+ messages in thread
From: Thierry Volpiatto @ 2014-02-25 18:40 UTC (permalink / raw)
  To: 16882


Hi Martin,

the change introduced by this commit is breaking
with-temp-buffer-window:

--8<---------------cut here---------------start------------->8---
commit 7e85209801a75d074fb0d952d38cf3f1e45ba1f7
Author: martin rudalics <rudalics@gmx.at>
Date:   Fri Feb 21 12:04:27 2014 +0100

    In with-temp-buffer-window don't evaluate BODY within with-current-buffer (Bug#16816).
    
    * window.el (with-temp-buffer-window): Don't evaluate BODY within
    with-current-buffer (Bug#16816).
--8<---------------cut here---------------end--------------->8---

The content of body is printed in current-buffer instead of being
printed in the temp buffer.

I will inline the emacs-24.3 version waiting a fix.

Thanks.



In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, X toolkit)
 of 2014-02-24 on dell-14z
Windowing system distributor `The X.Org Foundation', version 11.0.11103000
System Description:	Ubuntu 12.04.4 LTS

Configured using:
 `configure --with-x-toolkit=lucid --without-toolkit-scroll-bars
 --without-gconf --without-gsettings'

Important settings:
  value of $LC_MONETARY: fr_FR.UTF-8
  value of $LC_NUMERIC: fr_FR.UTF-8
  value of $LC_TIME: fr_FR.UTF-8
  value of $LANG: fr_FR.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  git-gutter-mode: t
  psession-mode: t
  global-semanticdb-minor-mode: t
  global-semantic-idle-scheduler-mode: t
  semantic-mode: t
  golden-ratio-mode: t
  winner-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  auto-image-file-mode: t
  eldoc-in-minibuffer-mode: t
  show-paren-mode: t
  display-time-mode: t
  recentf-mode: t
  savehist-mode: t
  eldoc-mode: t
  minibuffer-depth-indicate-mode: t
  helm-mode: t
  helm-descbinds-mode: t
  shell-dirtrack-mode: t
  helm-adaptative-mode: t
  helm-match-plugin-mode: t
  helm-occur-match-plugin-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-< C-x C-² C-x C-b <down> <down> <down> <down> <return> 
C-x C-f * . e l M-C C-g C-_ C-x C-b <down> <return> 
C-x C-d C-e l l <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
SPC <C-M-down> <C-M-down> <C-M-down> <C-M-down> <C-M-down> 
<C-M-down> <C-M-down> <C-M-down> <C-M-down> <C-M-down> 
<C-M-down> <C-M-down> <C-M-down> C-< <up> <up> <up> 
<up> <up> <up> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> M-x t v SPC b <return> <return> 
q SPC SPC C-< <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> C-SPC C-n C-n C-n C-n 
C-n C-n C-n C-n M-w q q q M-x r e p o <return>

Recent messages:
Restoring buffers...73%
Setting up indent for shell type bash
Indentation variables are now local.
Indentation setup for shell type bash
Restoring buffers...done
(No files need saving)
Type a prefix key to toggle it. Run 'actions' with their prefixes. '?' for more help.
Starting Firefox...
Beginning of buffer
Mark set

Load-path shadows:
/usr/local/share/emacs/24.3.50/lisp/gnus/.dir-locals hides ~/elisp/magit/.dir-locals
~/elisp/auctex/lpath hides ~/elisp/emacs-wget/lpath
/usr/local/share/emacs/24.3.50/lisp/emacs-lisp/tq hides ~/elisp/emms/lisp/tq

Features:
(shadow gnus-dired nnir mail-extr gnus-msg gnus-art mm-uu mml2015
mm-view mml-smime smime dig gnus-sum nnoo gnus-group gnus-undo nnmail
mail-source gnus-start gnus-spec gnus-int gnus-range gnus-win
helm-dabbrev emacsbug helm-command magit-cherry magit-bisect
magit-log-edit log-edit add-log magit-key-mode magit view ediff-merg
ediff-wind ediff-diff ediff-mult ediff-help ediff-init ediff-util ediff
diff-mode magit-compat ido vc-hg semantic/bovine/make semantic/analyze
semantic/sort semantic/scope semantic/analyze/fcn
semantic/bovine/make-by semantic/bovine make-mode markdown-mode
sh-script smie executable conf-mode vc-rcs semantic/tag-file
semantic/db-file data-debug cedet-files semantic/wisent/python
semantic/decorate/include semantic/db-find semantic/db-ref
semantic/decorate/mode semantic/decorate pulse semantic/dep
semantic/wisent/python-wy semantic/wisent semantic/wisent/wisent rx
vc-git naquadah-theme em-unix em-script em-prompt em-ls em-hist em-pred
em-glob em-dirs em-cmpl em-basic em-banner em-alias align-let git-gutter
server persistent-sessions semantic/db-mode semantic/db eieio-base
semantic/idle semantic/format ezimage semantic/tag-ls semantic/find
semantic/ctxt semantic/util-modes semantic/util semantic semantic/tag
semantic/lex semantic/fw mode-local cedet config-w3m w3m-search w3m
timezone w3m-hist w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl w3m-favicon
w3m-image w3m-proc w3m-util w3m-load golden-ratio winner undo-tree diff
image-file newsticker newst-treeview newst-plainview newst-reader
newst-ticker newst-backend xdvi-search preview-latex tex-site auto-loads
pcomplete-extension em-term term disp-table ehelp helm-ipython
helm-elisp helm-eval python eldoc-eval warnings whitespace paren time
avoid recentf tree-widget savehist smtpmail-async smtpmail sendmail
dired-async iterator simple-call-tree iedit-rect rect iedit iedit-lib
smallurl mm-url gnus gnus-ems nnheader wid-edit rectangle-utils
ledger-config ledger esh-var esh-io esh-cmd esh-opt esh-ext esh-proc
eldoc esh-groups eshell esh-module esh-mode esh-arg esh-util tv-utils
async pcvs vc-cvs pcvs-parse pcvs-info pcvs-defs pcvs-util ewoc mb-depth
cl-info slime-autoloads esh-toggle flymake no-word htmlize cl
dired-extension emms-mpd-config emms-playlist-limit emms-volume
emms-volume-amixer emms-i18n emms-history emms-score emms-stream-info
emms-metaplaylist-mode emms-bookmarks emms-cue emms-mode-line-icon
emms-browser sort emms-playlist-sort emms-last-played emms-player-xine
emms-player-mpd tq emms-playing-time emms-lyrics emms-url hl-line
emms-tag-editor emms-mark emms-mode-line emms-cache emms-info-ogginfo
emms-info-mp3info emms-playlist-mode emms-player-vlc emms-player-mplayer
emms-info emms-streams later-do emms-source-playlist emms-source-file
emms-player-simple emms-setup emms emms-compat org-config-thierry ob-sh
org-crypt cal-china lunar solar cal-dst cal-bahai cal-islam cal-hebrew
holidays hol-loaddefs appt diary-lib diary-loaddefs org-element
org-rmail org-mhe org-irc org-info org-gnus org-docview doc-view
jka-compr image-mode org-bibtex bibtex org-bbdb org-w3m org-agenda
org-annotation-helper addressbook-bookmark message rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev mail-utils gmm-utils mailheader firefox-protocol
bookmark-firefox-handler bookmark-extensions org org-macro org-footnote
org-pcomplete org-list org-faces org-entities noutline outline
easy-mmode org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob
ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs find-func cal-menu calendar cal-loaddefs init-helm-thierry
helm-mode helm-dictionary helm-ls-git helm-descbinds helm-ls-hg
helm-files image-dired tramp tramp-compat tramp-loaddefs trampver shell
pcomplete format-spec dired-x dired-aux ffap thingatpt helm-buffers
helm-elscreen helm-tags helm-bookmark helm-adaptative helm-info helm-net
browse-url xml url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util url-parse url-vars mailcap
helm-plugin bookmark pp helm-help helm-match-plugin helm-grep wgrep-helm
wgrep helm-regexp grep helm-external helm-utils dired compile comint
ansi-color ring helm-locate helm vc vc-dispatcher helm-config
helm-aliases epa-file epa derived epg epg-config auth-source eieio
byte-opt bytecomp byte-compile cconv eieio-core gnus-util time-date
mm-util mail-prsvr password-cache package info easymenu cl-macs gv
edmacro kmacro advice help-fns net-utils cl-loaddefs cl-lib tooltip
electric uniquify 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 nadvice 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 font-render-setting x-toolkit x
multi-tty emacs)

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 





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

* bug#16882: 24.3.50; with-temp-buffer-window broken
  2014-02-25 18:40 bug#16882: 24.3.50; with-temp-buffer-window broken Thierry Volpiatto
@ 2014-02-25 19:00 ` Glenn Morris
  2014-02-25 19:43   ` Thierry Volpiatto
  0 siblings, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2014-02-25 19:00 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 16882

Thierry Volpiatto wrote:

> The content of body is printed in current-buffer instead of being
> printed in the temp buffer.

Please explain what you mean by "the content of body".

Note that with-temp-buffer-window's doc has always said:

   "It does not make the buffer current for BODY."

Things like:

  (with-temp-buffer-window "foo" nil nil (princ "hello"))

continue to work just fine, as documented.





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

* bug#16882: 24.3.50; with-temp-buffer-window broken
  2014-02-25 19:00 ` Glenn Morris
@ 2014-02-25 19:43   ` Thierry Volpiatto
  2014-02-26 10:17     ` martin rudalics
  0 siblings, 1 reply; 10+ messages in thread
From: Thierry Volpiatto @ 2014-02-25 19:43 UTC (permalink / raw)
  To: 16882

Glenn Morris <rgm@gnu.org> writes:

> Note that with-temp-buffer-window's doc has always said:
>
>    "It does not make the buffer current for BODY."

But the code was doing a different thing, you had better time to fix
docstring according to code instead of doing the contrary.
This make incompatible change between 24.3 and 24.4.

> continue to work just fine, as documented.

Good for you, so close the bug if you are happy with this.

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 






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

* bug#16882: 24.3.50; with-temp-buffer-window broken
  2014-02-25 19:43   ` Thierry Volpiatto
@ 2014-02-26 10:17     ` martin rudalics
  2014-02-26 10:34       ` Thierry Volpiatto
  2014-02-28  7:20       ` Thierry Volpiatto
  0 siblings, 2 replies; 10+ messages in thread
From: martin rudalics @ 2014-02-26 10:17 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 16882

 >> Note that with-temp-buffer-window's doc has always said:
 >>
 >>    "It does not make the buffer current for BODY."
 >
 > But the code was doing a different thing, you had better time to fix
 > docstring according to code instead of doing the contrary.
 > This make incompatible change between 24.3 and 24.4.

The problem is that `with-temp-buffer-window' should substitute
`with-output-to-temp-buffer' and the latter doesn't make the buffer
current.  As a matter of fact, the inconsistency you discovered could
have led to output misleading text, for example, if BODY tried to print
the value of the current buffer and that buffer would be that of the
temporary buffer.  The idea is that from Emacs' POV the temporary buffer
doesn't exist unless you consider standard output part of that view.

I deeply apologize for the inconveniences this has caused you.  More so
because if you hadn't reported this bug you would not have experienced
them in the first place.  Nevertheless note that you have reported a bug
which may have already caused people to misinterpret Help information
without noting it.  So yours was a very valuable contribution.

I sincerely hope that you can rearrange you code accordingly.

Thanks, martin





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

* bug#16882: 24.3.50; with-temp-buffer-window broken
  2014-02-26 10:17     ` martin rudalics
@ 2014-02-26 10:34       ` Thierry Volpiatto
  2014-02-28  7:20       ` Thierry Volpiatto
  1 sibling, 0 replies; 10+ messages in thread
From: Thierry Volpiatto @ 2014-02-26 10:34 UTC (permalink / raw)
  To: martin rudalics; +Cc: 16882

martin rudalics <rudalics@gmx.at> writes:

> The problem is that `with-temp-buffer-window' should substitute
> `with-output-to-temp-buffer' and the latter doesn't make the buffer
> current.  As a matter of fact, the inconsistency you discovered could
> have led to output misleading text, for example, if BODY tried to print
> the value of the current buffer and that buffer would be that of the
> temporary buffer.  The idea is that from Emacs' POV the temporary buffer
> doesn't exist unless you consider standard output part of that view.
>
> I deeply apologize for the inconveniences this has caused you.  More so
> because if you hadn't reported this bug you would not have experienced
> them in the first place.  Nevertheless note that you have reported a bug
> which may have already caused people to misinterpret Help information
> without noting it.  So yours was a very valuable contribution.

Thanks for explanation.

> I sincerely hope that you can rearrange you code accordingly.

Done thanks, I have now a macro similar to `with-temp-buffer-window' but
that doesn't expect standard-output.

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 





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

* bug#16882: 24.3.50; with-temp-buffer-window broken
  2014-02-26 10:17     ` martin rudalics
  2014-02-26 10:34       ` Thierry Volpiatto
@ 2014-02-28  7:20       ` Thierry Volpiatto
  2014-02-28 10:59         ` martin rudalics
  1 sibling, 1 reply; 10+ messages in thread
From: Thierry Volpiatto @ 2014-02-28  7:20 UTC (permalink / raw)
  To: martin rudalics; +Cc: 16882, Thierry Volpiatto


martin rudalics <rudalics@gmx.at> writes:

> The idea is that from Emacs' POV the temporary buffer
> doesn't exist unless you consider standard output part of that view.

Just a note on this: (Sorry to insist)

You expect here the code of 'body' returns a stream like prin* function
family does, but IMHO 'body' should be any code that is self
contained in the "temp-buffer-window" and not elsewhere.
IOW the actual version is not safe in this sens because it may affect
the current-buffer.
I suspect already existing code is affected by this new behavior.

Try:

(with-temp-buffer-window "foo" nil nil (princ "hello"))

and now

(with-temp-buffer-window "foo" nil nil (insert "hello"))

I expect here "hello" to be inserted in "foo" buffer, but actually it
corrupt current-buffer.

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 






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

* bug#16882: 24.3.50; with-temp-buffer-window broken
  2014-02-28  7:20       ` Thierry Volpiatto
@ 2014-02-28 10:59         ` martin rudalics
  2014-02-28 12:43           ` Thierry Volpiatto
  2014-03-16 10:01           ` martin rudalics
  0 siblings, 2 replies; 10+ messages in thread
From: martin rudalics @ 2014-02-28 10:59 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 16882

 > Just a note on this: (Sorry to insist)
 >
 > You expect here the code of 'body' returns a stream like prin* function
 > family does, but IMHO 'body' should be any code that is self
 > contained in the "temp-buffer-window" and not elsewhere.
 > IOW the actual version is not safe in this sens because it may affect
 > the current-buffer.
 > I suspect already existing code is affected by this new behavior.
 >
 > Try:
 >
 > (with-temp-buffer-window "foo" nil nil (princ "hello"))
 >
 > and now
 >
 > (with-temp-buffer-window "foo" nil nil (insert "hello"))
 >
 > I expect here "hello" to be inserted in "foo" buffer, but actually it
 > corrupt current-buffer.

As the bug found by Juanma shows I was fooled by this myself.  It should
now behave again in your sense.  I still have to explain the behavior in
the manual.

Thanks, martin





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

* bug#16882: 24.3.50; with-temp-buffer-window broken
  2014-02-28 10:59         ` martin rudalics
@ 2014-02-28 12:43           ` Thierry Volpiatto
  2014-02-28 18:28             ` martin rudalics
  2014-03-16 10:01           ` martin rudalics
  1 sibling, 1 reply; 10+ messages in thread
From: Thierry Volpiatto @ 2014-02-28 12:43 UTC (permalink / raw)
  To: martin rudalics; +Cc: 16882, Thierry Volpiatto


martin rudalics <rudalics@gmx.at> writes:

> As the bug found by Juanma shows I was fooled by this myself.  It should
> now behave again in your sense.

Great, thanks.

-- 
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 






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

* bug#16882: 24.3.50; with-temp-buffer-window broken
  2014-02-28 12:43           ` Thierry Volpiatto
@ 2014-02-28 18:28             ` martin rudalics
  0 siblings, 0 replies; 10+ messages in thread
From: martin rudalics @ 2014-02-28 18:28 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 16882-done

Closing this bug then ...

martin





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

* bug#16882: 24.3.50; with-temp-buffer-window broken
  2014-02-28 10:59         ` martin rudalics
  2014-02-28 12:43           ` Thierry Volpiatto
@ 2014-03-16 10:01           ` martin rudalics
  1 sibling, 0 replies; 10+ messages in thread
From: martin rudalics @ 2014-03-16 10:01 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: 16882

 > As the bug found by Juanma shows I was fooled by this myself.  It should
 > now behave again in your sense.  I still have to explain the behavior in
 > the manual.

Sorry, but I had to revert that once more in the light of bug#17007.  A
major aspect of `with-temp-buffer-window' was (and the doc-string
indicated it) to evaluate BODY in the original buffer in order to get
the local variables, settings and keybindings of that buffer right.  I
messed that up in the Emacs 24.3 version of the macro and now have it do
what the doc-string indicated then.  So you will have to change your
code as I suggested earlier.

As a remedy you can now use the new macro `with-current-buffer-window'
instead which does exactly what `with-temp-buffer-window' did in Emacs
24.3.  This might not be the most convenient way to work with the same
code in Emacs 24.3 and subsequent versions but it's the best I can
offer.

Apologizing again, martin





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

end of thread, other threads:[~2014-03-16 10:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-25 18:40 bug#16882: 24.3.50; with-temp-buffer-window broken Thierry Volpiatto
2014-02-25 19:00 ` Glenn Morris
2014-02-25 19:43   ` Thierry Volpiatto
2014-02-26 10:17     ` martin rudalics
2014-02-26 10:34       ` Thierry Volpiatto
2014-02-28  7:20       ` Thierry Volpiatto
2014-02-28 10:59         ` martin rudalics
2014-02-28 12:43           ` Thierry Volpiatto
2014-02-28 18:28             ` martin rudalics
2014-03-16 10:01           ` martin rudalics

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).