GNU bug report logs - #32000
26.1; Behavior of buffer-offer-save not lining up with documentation

Previous Next

Package: emacs;

Reported by: Brad Lindsay <sluggy.fan <at> gmail.com>

Date: Thu, 28 Jun 2018 23:02:02 UTC

Severity: minor

Tags: fixed

Found in version 26.1

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32000 in the body.
You can then email your comments to 32000 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#32000; Package emacs. (Thu, 28 Jun 2018 23:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Brad Lindsay <sluggy.fan <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 28 Jun 2018 23:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Brad Lindsay <sluggy.fan <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.1; Behavior of buffer-offer-save not lining up with documentation
Date: Thu, 28 Jun 2018 15:56:59 -0700
I am trying to create a function that creates a new empty buffer that
prompts you to save it when you kill it. Reading through the
documentation, it looks like I need to set “buffer-offer-save” to a
non-nil value since the new buffer is not a file-visiting buffer. I
have tried doing that, and verifying that the variable isn’t set and
that the new buffer isn’t empty, but when I close (kill) the buffer, I
don’t get a prompt.

Here is my function definition:


(defun buffer-new ()
  "Creates a new Untitled buffer with the same modes as the current one."
  (interactive)
  (let
      ((new-buffer (generate-new-buffer "Untitled"))
       (mode major-mode))
    (switch-to-buffer new-buffer)
    (funcall mode)
    (setq buffer-offer-save t)
    new-buffer)
  )




In GNU Emacs 26.1 (build 1, x86_64-apple-darwin14.5.0, NS
appkit-1348.17 Version 10.10.5 (Build 14F2511))
 of 2018-05-30 built on builder10-10.porkrind.org
Windowing system distributor 'Apple', version 10.3.1641
Recent messages:
Wrote /Users/bladmin/.emacs.d/init/editor.el
C-c C-g is undefined
Importing package-keyring.gpg...done
Package refresh done
C-c h is undefined
Type C-x 1 to delete the help window.
Mark set [2 times]
Saving file /Users/bladmin/.emacs.d/init/editor.el...
Wrote /Users/bladmin/.emacs.d/init/editor.el
Quit

Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  subword-mode: t
  display-line-numbers-mode: t
  company-flx-mode: t
  company-mode: t
  desktop-save-mode: t
  yas-minor-mode: t
  global-origami-mode: t
  origami-mode: t
  projectile-mode: t
  ido-vertical-mode: t
  flx-ido-mode: t
  ido-everywhere: t
  xterm-mouse-mode: t
  delete-selection-mode: t
  electric-pair-mode: t
  show-paren-mode: t
  global-auto-revert-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-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
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail pp cl-print help-fns radix-tree
mm-archive message dired dired-loaddefs format-spec rfc822 mml mml-sec
epa derived gnus-util rmail rmail-loaddefs mailabbrev gmm-utils
mailheader mm-decode mm-bodies mm-encode mail-utils network-stream
starttls url-cache epg rspec-mode robe inf-ruby ruby-mode vc-git
diff-mode company-oddmuse company-keywords company-etags company-gtags
company-files company-capf company-cmake company-xcode company-clang
company-semantic company-eclim company-template company-bbdb
company-robe cap-words superword subword display-line-numbers
exec-path-from-shell web-mode disp-table pug-mode alchemist
alchemist-macroexpand alchemist-company alchemist-help
alchemist-complete company-dabbrev-code company-dabbrev
alchemist-refcard alchemist-phoenix alchemist-compile alchemist-iex
alchemist-message easy-mmode alchemist-hooks alchemist-hex alchemist-mix
alchemist-info alchemist-goto alchemist-scope etags xref project
alchemist-eval alchemist-interact alchemist-server alchemist-execute
alchemist-report alchemist-test-mode alchemist-project alchemist-file
alchemist-key alchemist-utils elixir-mode elixir-format pkg-info
url-http tls gnutls url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr url-gw nsm rmc puny find-func lisp-mnt epl
elixir-smie company-flx company pcase elm-mode elm-interactive url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap subr-x elm-font-lock elm-indent elm-imenu
imenu elm-format elm-tags elm-util let-alist json map f dockerfile-mode
sh-script smie executable yaml-mode chruby desktop frameset cus-start
cus-load yasnippet key-chord cl-extra help-mode hydra lv neotree origami
origami-parsers rx cl s dash projectile grep compile comint ansi-color
ring ibuf-ext ibuffer ibuffer-loaddefs thingatpt ido-vertical-mode
flx-ido advice flx ido material_darker-theme xt-mouse delsel elec-pair
paren autorevert filenotify edmacro kmacro finder-inf info package
easymenu epg-config url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache url-vars seq byte-opt
gv bytecomp byte-compile cconv cl-loaddefs cl-lib time-date tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded 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 kqueue cocoa ns
multi-tty make-network-process emacs)

Memory information:
((conses 16 478806 471794)
 (symbols 48 37892 10)
 (miscs 40 1233 376)
 (strings 32 113275 66990)
 (string-bytes 1 4372073)
 (vectors 16 68500)
 (vector-slots 8 1933976 243756)
 (floats 8 104 570)
 (intervals 56 996 636)
 (buffers 992 18))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32000; Package emacs. (Thu, 28 Jun 2018 23:34:01 GMT) Full text and rfc822 format available.

Message #8 received at 32000 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Brad Lindsay <sluggy.fan <at> gmail.com>
Cc: 32000 <at> debbugs.gnu.org
Subject: Re: bug#32000: 26.1;
 Behavior of buffer-offer-save not lining up with documentation
Date: Thu, 28 Jun 2018 19:33:35 -0400
Brad Lindsay <sluggy.fan <at> gmail.com> writes:

> I am trying to create a function that creates a new empty buffer that
> prompts you to save it when you kill it. Reading through the
> documentation, it looks like I need to set “buffer-offer-save” to a
> non-nil value since the new buffer is not a file-visiting buffer. I
> have tried doing that, and verifying that the variable isn’t set and
> that the new buffer isn’t empty, but when I close (kill) the buffer, I
> don’t get a prompt.

buffer-offer-save is for killing Emacs or save-some-buffers, to catch
buffer killing use kill-buffer-query-functions.  We could probably make
the docs a bit more explicit about this.

Or maybe we should enhance buffer-offer-save to cover the buffer killing
case too, it seems a bit silly to require setting both.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32000; Package emacs. (Fri, 29 Jun 2018 00:49:02 GMT) Full text and rfc822 format available.

Message #11 received at 32000 <at> debbugs.gnu.org (full text, mbox):

From: Brad Lindsay <sluggy.fan <at> gmail.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 32000 <at> debbugs.gnu.org
Subject: Re: bug#32000: 26.1;
 Behavior of buffer-offer-save not lining up with documentation
Date: Thu, 28 Jun 2018 17:41:13 -0700
On June 28, 2018 at 6:33:38 PM, Noam Postavsky (npostavs <at> gmail.com) wrote:
> Brad Lindsay writes:
>
> > I am trying to create a function that creates a new empty buffer that
> > prompts you to save it when you kill it. Reading through the
> > documentation, it looks like I need to set “buffer-offer-save” to a
> > non-nil value since the new buffer is not a file-visiting buffer. I
> > have tried doing that, and verifying that the variable isn’t set and
> > that the new buffer isn’t empty, but when I close (kill) the buffer, I
> > don’t get a prompt.
>
> buffer-offer-save is for killing Emacs or save-some-buffers, to catch
> buffer killing use kill-buffer-query-functions. We could probably make
> the docs a bit more explicit about this.
>
> Or maybe we should enhance buffer-offer-save to cover the buffer killing
> case too, it seems a bit silly to require setting both.
>

I was successfully able to implement a kill-buffer-query-functions
hook. Thanks for that pointer. I think it would be good to enhance
buffer-offer-save to cover killing a buffer for any reason.

Thanks,
Brad




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32000; Package emacs. (Sat, 12 Oct 2019 21:23:02 GMT) Full text and rfc822 format available.

Message #14 received at 32000 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 32000 <at> debbugs.gnu.org, Brad Lindsay <sluggy.fan <at> gmail.com>
Subject: Re: bug#32000: 26.1; Behavior of buffer-offer-save not lining up
 with documentation
Date: Sat, 12 Oct 2019 23:22:54 +0200
Noam Postavsky <npostavs <at> gmail.com> writes:

> Brad Lindsay <sluggy.fan <at> gmail.com> writes:
>
>> I am trying to create a function that creates a new empty buffer that
>> prompts you to save it when you kill it. Reading through the
>> documentation, it looks like I need to set “buffer-offer-save” to a
>> non-nil value since the new buffer is not a file-visiting buffer. I
>> have tried doing that, and verifying that the variable isn’t set and
>> that the new buffer isn’t empty, but when I close (kill) the buffer, I
>> don’t get a prompt.
>
> buffer-offer-save is for killing Emacs or save-some-buffers, to catch
> buffer killing use kill-buffer-query-functions.  We could probably make
> the docs a bit more explicit about this.

Looks like the doc string here was fixed a couple of days after this was
reported, so I'm closing the bug report now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 12 Oct 2019 21:24:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 32000 <at> debbugs.gnu.org and Brad Lindsay <sluggy.fan <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 12 Oct 2019 21:24:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 10 Nov 2019 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 160 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.