From: Noam Postavsky <npostavs@gmail.com>
To: Nicolas Richard <youngfrog@members.fsf.org>
Cc: 21201@debbugs.gnu.org, Artur Malabarba <bruce.connor.am@gmail.com>
Subject: bug#21201: 25.0.50; (buffer-modified-p) errors inside cl-letf
Date: Tue, 17 Jul 2018 08:16:09 -0400 [thread overview]
Message-ID: <87pnzm83cm.fsf@gmail.com> (raw)
In-Reply-To: <8637zwghfe.fsf@members.fsf.org> (Nicolas Richard's message of "Fri, 07 Aug 2015 00:50:45 +0200")
[-- Attachment #1: Type: text/plain, Size: 671 bytes --]
tags 21201 + patch
quit
Nicolas Richard <youngfrog@members.fsf.org> writes:
> Artur Malabarba <bruce.connor.am@gmail.com> writes:
>> 2015-08-06 21:07 GMT+01:00 Nicolas Richard <youngfrog@members.fsf.org>:
>>> (gv-define-setter buffer-modified-p (flag &optional buf)
>>> - `(with-current-buffer ,buf
>>> - (set-buffer-modified-p ,flag)))
>>> + (if buf
>>> + `(with-current-buffer ,buf
>>> + (set-buffer-modified-p ,flag))
>>> + `(set-buffer-modified-p ,flag)))
>>
>> Don't know if it's possible, but shouldn't it try to ensure that it's
>> in the same buffer as before?
>
> I agree with you, but I don't know how to do that.
This seems to work.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1153 bytes --]
From 1481f8893ff04a83b578f403cd22c7bdd2ec65f0 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Mon, 16 Jul 2018 22:14:32 -0400
Subject: [PATCH] Allow setf of buffer-modified-p without argument (Bug#21201)
* lisp/emacs-lisp/cl-lib.el (setf buffer-modified-p): Take current
buffer if optional argument BUF is not passed.
---
lisp/emacs-lisp/cl-lib.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index 381784d1fd..ba5f9d64a1 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -521,8 +521,9 @@ cl-pairlis
;; Some more Emacs-related place types.
(gv-define-simple-setter buffer-file-name set-visited-file-name t)
(gv-define-setter buffer-modified-p (flag &optional buf)
- `(with-current-buffer ,buf
- (set-buffer-modified-p ,flag)))
+ (macroexp-let2 nil buffer `(or ,buf (current-buffer))
+ `(with-current-buffer ,buffer
+ (set-buffer-modified-p ,flag))))
(gv-define-simple-setter buffer-name rename-buffer t)
(gv-define-setter buffer-string (store)
`(insert (prog1 ,store (erase-buffer))))
--
2.11.0
next prev parent reply other threads:[~2018-07-17 12:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-06 19:47 bug#21201: 25.0.50; (buffer-modified-p) errors inside cl-letf Artur Malabarba
2015-08-06 20:07 ` Nicolas Richard
2015-08-06 21:44 ` Artur Malabarba
2015-08-06 22:50 ` Nicolas Richard
2018-07-17 12:16 ` Noam Postavsky [this message]
2018-08-28 0:01 ` Noam Postavsky
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pnzm83cm.fsf@gmail.com \
--to=npostavs@gmail.com \
--cc=21201@debbugs.gnu.org \
--cc=bruce.connor.am@gmail.com \
--cc=youngfrog@members.fsf.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.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).