all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Philipp Stephani <phst@google.com>, Eli Zaretskii <eliz@gnu.org>,
	Emacs developers <emacs-devel@gnu.org>
Subject: Re: [PATCH] Allow inhibiting 'auto-save-visited-mode' on a per-buffer basis.
Date: Sun, 5 Apr 2020 17:51:18 +0200	[thread overview]
Message-ID: <CAArVCkTk51a_3r7eAzS8wYkXJSE69=HVQkpnpr7_4y1zRmew0A@mail.gmail.com> (raw)
In-Reply-To: <jwva73qhvjk.fsf-monnier+emacs@gnu.org>

Am So., 5. Apr. 2020 um 16:19 Uhr schrieb Stefan Monnier
<monnier@iro.umontreal.ca>:
>
> >> diff --git a/lisp/files.el b/lisp/files.el
> >> index 55a0958f54..5132aa456a 100644
> >> --- a/lisp/files.el
> >> +++ b/lisp/files.el
> >> @@ -441,6 +441,7 @@ auto-save-visited-mode
> >>             #'save-some-buffers :no-prompt
> >>             (lambda ()
> >>               (and buffer-file-name
> >> +                  auto-save-visited-mode
> >>                    (not (and buffer-auto-save-file-name
> >>                              auto-save-visited-file-name))))))))
> >
> > Is this really OK?
>
> Depends what you mean by "this".  The above patch is definitely
> OK, yes.  It's actually "standard operation procedure" for a minor mode
> to double check its minor mode variable in timers and hooks ;-)
>
> > All minor mode variables, including auto-save-visited-mode, by default
> > get the "Setting this variable directly does not take effect"
> > documentation string, because we want to use minor mode variables only
> > for checking a mode's state and always want users to call the
> > mode function.
>
> Indeed the above implies suggestions to do:
>
>     (add-hook 'foo-mode-hook
>               (lambda () (setq-local auto-save-visited-mode nil)))
>
> which doesn't go through such functions and is hence arguably "bad
> style".  Especially it will likely encourage the use of plain `setq` on
> the variable.
>
> This part of what I meant by "...but lacks the rest of the code".
> The rest would be something like
>
>     (define-minor-mode auto-save-visited-local-mode ...)
>
> which would do the `setq-local` internally and might take inspiration
> from `electric-indent-local-mode`.
>


Wouldn't such a minor mode be confusing, because you'd have to enable
both the global and the local minor mode for the functionality to
work?



  reply	other threads:[~2020-04-05 15:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01 17:57 [PATCH] Allow inhibiting 'auto-save-visited-mode' on a per-buffer basis Philipp Stephani
2020-04-02  9:24 ` Robert Pluim
2020-04-02  9:40   ` Philipp Stephani
2020-04-02  9:47     ` Robert Pluim
2020-04-02  9:59       ` Štěpán Němec
2020-04-02 11:15         ` Philipp Stephani
2020-04-02 11:27           ` Štěpán Němec
2020-04-02 13:38 ` Eli Zaretskii
2020-04-02 15:22   ` Stefan Monnier
2020-04-05  9:50     ` Philipp Stephani
2020-04-05 14:18       ` Stefan Monnier
2020-04-05 15:51         ` Philipp Stephani [this message]
2020-04-05 18:49           ` Stefan Monnier
2020-04-05 19:58             ` Philipp Stephani
2020-04-08 11:43               ` Philipp Stephani
2020-04-08 12:03                 ` Eli Zaretskii
2020-04-08 12:19                   ` Philipp Stephani
2020-04-08 13:07                     ` Eli Zaretskii
2020-04-08 14:58                 ` Stefan Monnier
2020-04-11 16:57                   ` Philipp Stephani
2020-04-11 17:11                     ` Stefan Monnier
2020-05-25 19:16                       ` Philipp Stephani
2020-04-05  9:52   ` Philipp Stephani
2020-04-05 13:11     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAArVCkTk51a_3r7eAzS8wYkXJSE69=HVQkpnpr7_4y1zRmew0A@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=phst@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.