GNU bug report logs -
#29371
26.0.50; (setf (buffer-modified-p) t) bug
Previous Next
Reported by: Devon Sean McCullough <Emacs-Hacker2017 <at> jovi.net>
Date: Tue, 21 Nov 2017 01:54:02 UTC
Severity: minor
Tags: fixed, patch
Merged with 21201
Found in versions 25.0.50, 26.0.50
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #9 received at control <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 21201 + patch
quit
Nicolas Richard <youngfrog <at> members.fsf.org> writes:
> Artur Malabarba <bruce.connor.am <at> gmail.com> writes:
>> 2015-08-06 21:07 GMT+01:00 Nicolas Richard <youngfrog <at> 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.
[0001-Allow-setf-of-buffer-modified-p-without-argument-Bug.patch (text/x-diff, inline)]
From 1481f8893ff04a83b578f403cd22c7bdd2ec65f0 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> 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
This bug report was last modified 6 years and 270 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.