unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo Liu <sdl.web@gmail.com>
To: 16804@debbugs.gnu.org
Subject: bug#16804: 24.3.50; [PATCH] fix with-silent-modifications
Date: Wed, 19 Feb 2014 08:34:15 +0800	[thread overview]
Message-ID: <m1eh30hreg.fsf@gmail.com> (raw)

I was confused by why an eldoc-documentation-function always gets a nil
buffer-file-name in a js file in js2-mode. It turns out js2 wraps its
parsing routine in with-silent-modifications, thus all timers triggered
while parsing gets the nil value for buffer-file-name.

Any comments on the following fix? Thanks.


=== modified file 'lisp/subr.el'
--- lisp/subr.el	2014-02-12 19:40:35 +0000
+++ lisp/subr.el	2014-02-19 00:18:31 +0000
@@ -3172,21 +3172,24 @@
 Typically used around modifications of text-properties which do
 not really affect the buffer's content."
   (declare (debug t) (indent 0))
-  (let ((modified (make-symbol "modified")))
+  (let ((modified (make-symbol "modified"))
+	(mtime (make-symbol "mtime")))
     `(let* ((,modified (buffer-modified-p))
             (buffer-undo-list t)
             (inhibit-read-only t)
             (inhibit-modification-hooks t)
             deactivate-mark
-            ;; Avoid setting and removing file locks and checking
-            ;; buffer's uptodate-ness w.r.t the underlying file.
-            buffer-file-name
-            buffer-file-truename)
+            ;; Avoid checking buffer's uptodate-ness w.r.t the
+            ;; underlying file.
+            (,mtime (visited-file-modtime))
+	    ;; Avoid setting and removing file locks
+            (create-lockfiles nil))
        (unwind-protect
-           (progn
-             ,@body)
+           (progn ,@body)
          (unless ,modified
-           (restore-buffer-modified-p nil))))))
+           (restore-buffer-modified-p nil))
+	 (when (consp ,mtime)
+	   (set-visited-file-modtime ,mtime))))))
 
 (defmacro with-output-to-string (&rest body)
   "Execute BODY, return the text it sent to `standard-output', as a string."






             reply	other threads:[~2014-02-19  0:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19  0:34 Leo Liu [this message]
2014-02-19  4:39 ` bug#16804: 24.3.50; [PATCH] fix with-silent-modifications Stefan Monnier
2014-02-19  6:10   ` Leo Liu
2014-02-19 14:28     ` Stefan Monnier
2014-02-19 15:35       ` Leo Liu
2014-02-19 18:30         ` Stefan Monnier
2014-02-20  0:33           ` Leo Liu
2014-02-20  4:57             ` Stefan Monnier
2014-02-20  5:57               ` Leo Liu
2014-02-20 14:01                 ` Stefan Monnier
2014-02-20 14:38                   ` Leo Liu
2014-02-20 17:14                     ` Stefan Monnier
2014-02-21  0:29                       ` Leo Liu
2016-02-24  3:10                         ` Lars Ingebrigtsen

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=m1eh30hreg.fsf@gmail.com \
    --to=sdl.web@gmail.com \
    --cc=16804@debbugs.gnu.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).