all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#32000: 26.1; Behavior of buffer-offer-save not lining up with documentation
@ 2018-06-28 22:56 Brad Lindsay
  2018-06-28 23:33 ` Noam Postavsky
  0 siblings, 1 reply; 4+ messages in thread
From: Brad Lindsay @ 2018-06-28 22:56 UTC (permalink / raw)
  To: 32000

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





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

* bug#32000: 26.1; Behavior of buffer-offer-save not lining up with documentation
  2018-06-28 22:56 bug#32000: 26.1; Behavior of buffer-offer-save not lining up with documentation Brad Lindsay
@ 2018-06-28 23:33 ` Noam Postavsky
  2018-06-29  0:41   ` Brad Lindsay
  2019-10-12 21:22   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 4+ messages in thread
From: Noam Postavsky @ 2018-06-28 23:33 UTC (permalink / raw)
  To: Brad Lindsay; +Cc: 32000

Brad Lindsay <sluggy.fan@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.





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

* bug#32000: 26.1; Behavior of buffer-offer-save not lining up with documentation
  2018-06-28 23:33 ` Noam Postavsky
@ 2018-06-29  0:41   ` Brad Lindsay
  2019-10-12 21:22   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: Brad Lindsay @ 2018-06-29  0:41 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 32000

On June 28, 2018 at 6:33:38 PM, Noam Postavsky (npostavs@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





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

* bug#32000: 26.1; Behavior of buffer-offer-save not lining up with documentation
  2018-06-28 23:33 ` Noam Postavsky
  2018-06-29  0:41   ` Brad Lindsay
@ 2019-10-12 21:22   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-12 21:22 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 32000, Brad Lindsay

Noam Postavsky <npostavs@gmail.com> writes:

> Brad Lindsay <sluggy.fan@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





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

end of thread, other threads:[~2019-10-12 21:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-28 22:56 bug#32000: 26.1; Behavior of buffer-offer-save not lining up with documentation Brad Lindsay
2018-06-28 23:33 ` Noam Postavsky
2018-06-29  0:41   ` Brad Lindsay
2019-10-12 21:22   ` Lars Ingebrigtsen

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.