unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* notmuch.el, needs without-restriction to properly save draft
@ 2024-03-13 16:32 Marc Fargas
  2024-03-13 23:00 ` Carl Worth
  0 siblings, 1 reply; 23+ messages in thread
From: Marc Fargas @ 2024-03-13 16:32 UTC (permalink / raw)
  To: notmuch

Hi there,

I'm not sure if this is the appropiate mailing list for bugs regarding
notmuch.el (Notmuch in Emacs). Also, I'm not subscribed so please keep
me in CC!

I recently noticed that when saving drafts in notmuch I would loose all
the headers that are not normally visible on the compose
buffer. References, In-Reply-To and the likes.

By default, when when composing a Reply all those cool and nice headers
are narrowed out of the buffer. They show up on sending because
"message-send" will sort the headers breaking the restriction.

After digging, it seems that "(insert-buffer-substring buf)", in
"with-temporary-notmuch-message-buffer" which is used by
"notmuch-draft-save" is not seeing the buffer contents beyond the
buffer's current restriction.

Thus, "insert-buffer-substring buf" should be wrapped inside a
"without-restriction".

Doing this makes the saved draft keep all headers:

  (defun unrestrict-notmuch (orig-fn &rest args)
    (without-restriction
      (apply orig-fn args)))

  (advice-add #'notmuch-draft-postpone :around #'unrestrict-notmuch)

Note that when resuming the draft later on all headers will be visible,
still working out how to restore the narrow restriction there.

marc

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

end of thread, other threads:[~2024-06-19 10:48 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-13 16:32 notmuch.el, needs without-restriction to properly save draft Marc Fargas
2024-03-13 23:00 ` Carl Worth
2024-03-14 15:03   ` [PATCH] Use `without-restriction` in `with-temporary-notmuch-message-buffer` Marc Fargas
2024-03-15  8:33     ` Marc Fargas
2024-03-15  9:59       ` David Bremner
2024-03-24 17:04   ` notmuch.el, needs without-restriction to properly save draft Marc Fargas
2024-03-24 17:54     ` Marc Fargas
2024-04-04 11:13       ` Marc Fargas
2024-06-15 17:57       ` David Bremner
2024-06-17  9:27         ` Michael J Gruber
2024-06-17  9:53           ` Marc Fargas
2024-06-17 10:27             ` David Bremner
2024-06-17 10:29               ` David Bremner
2024-06-17 11:37             ` Marc Fargas
2024-06-17 14:04               ` [PATCH] Replace `without-restriction` with `save-restriction` michaeljgruber+grubix+git
2024-06-17 19:28                 ` [PATCH v2 1/2] " michaeljgruber+grubix+git
2024-06-17 19:28                 ` [PATCH v2 2/2] Replace `delete-line` with its definition michaeljgruber+grubix+git
2024-06-17 22:49                   ` David Bremner
2024-06-18  5:58                     ` Marc Fargas
2024-06-18 14:33                       ` Michael J Gruber
2024-06-19 10:48                   ` David Bremner
2024-06-17 14:28               ` notmuch.el, needs without-restriction to properly save draft David Bremner
2024-03-24 17:08   ` Marc Fargas

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.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).