all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Misunderstanding set-buffer-modified-p?
@ 2021-01-02  0:39 Eric Abrahamsen
  2021-01-02  6:02 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Abrahamsen @ 2021-01-02  0:39 UTC (permalink / raw)
  To: emacs-devel

Hi all,

A while ago I added a call to `set-buffer-modified-p' at the end of
`sieve-upload' (in ./lisp/net/sieve.el), to provide a better visual cue
to the user that the sieve script upload had succeeded (it suffers from
the "returns suspiciously fast" syndrome).

It "doesn't work", in the sense that the buffer modeline is still marked
modified after the function completes. It's not just a redisplay issue,
either: running M-: (buffer-modified-p) returns t.

However, manually running M-: (set-buffer-modified-p nil) after the
script is uploaded *does* successfully set the modified flag to nil and
update the modeline.

Can anyone tell me if I'm doing something wrong, or I've understood
something incorrectly?

(defun sieve-upload (&optional name)
  (interactive)
  (when (or (get-buffer sieve-buffer)
            (save-current-buffer (call-interactively 'sieve-manage)))
    (let ((script (buffer-string))
          (script-name (file-name-sans-extension (buffer-name)))
          err)
      (with-current-buffer (get-buffer sieve-buffer)
	(setq err (sieve-manage-putscript
                   (or name sieve-buffer-script-name script-name)
                   script sieve-manage-buffer))
        (if (not (sieve-manage-ok-p err))
            (message "Sieve upload failed: %s" (nth 2 err))
          (message "Sieve upload done.  Use %s to manage scripts."
                   (substitute-command-keys "\\[sieve-manage]"))
          (set-buffer-modified-p nil))))))




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

end of thread, other threads:[~2021-01-02 19:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-02  0:39 Misunderstanding set-buffer-modified-p? Eric Abrahamsen
2021-01-02  6:02 ` Lars Ingebrigtsen
2021-01-02 19:04   ` Eric Abrahamsen

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.