unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: wsnyder@wsnyder.org (Wilson Snyder)
Cc: emacs-devel@gnu.org
Subject: Re: Get rid of verilog-no-change-functions
Date: Tue, 15 Sep 2015 21:05:16 -0400	[thread overview]
Message-ID: <jwvk2rrdwbi.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <7qa8snz1g8.fsf@emma.svaha.wsnyder.org> (Wilson Snyder's message of "Tue, 15 Sep 2015 19:51:03 -0400")

>> Also, I see that verilog-save-no-change-functions is wrapped inside
>> verilog-save-font-mods in verilog-auto, but not in verilog-delete-auto.

> The common use of delete-auto is under verilog-auto itself,
> so if we added it to delete-auto we'd be calling the hooks
> at both auto's exiting of verilog-delete-auto and at the
> exit of verilog-auto itself.

`verilog-delete-auto' is an interactive function, so we do want to
handle that case as well.

> We'd then be better off pulling the guts out of
> verilog-delete-auto (without
> verilog-save-no-change-functions) and call those guts from
> verilog-auto and verilog-delete-auto.

Indeed, that would be to right thing to do, I think.

> But anyhow I've never heard complaints of verilog-delete-auto being
> slow as it makes an order-of-magnitude fewer changes, so doesn't seem
> worth the work.

You mean we could remove verilog-save-no-change-functions from it?
If you say so, that's fine by me.

> Also why do you suggest a defvar working would be an "accident"?
> These defvars only needs to exist when compiling.

*eval*uating (defvar foo) has no effect, other than to declare that var
to be dynamically scoped *in that scope*.  E.g.

   (defun bar ()
     (defvar foo)
     ...)

make `foo' be dynamically scoped in that scope.  So

   (eval-when-compile
     (defvar foo)
     ...)

Would most logically make `foo' be dynamically scoped within the
eval-when-compile but not outside of it.

The only reason why it works is an implementation accident:
eval-when-compile (when run from the byte-compiler) first compiles its
body, and that has the side-effect that it ends up declaring `foo' also
outside of the eval-when-compile.  It also has a few other side-effect,
and like this one, some of them are halfway between bugs and features.

>> (progn ,@body)
>> (and (not modified)
>> (buffer-modified-p)
>> -	    (set-buffer-modified-p nil)))))
>> +            (if (fboundp 'restore-buffer-modified-p)
>> +                (restore-buffer-modified-p nil)
>> +              (set-buffer-modified-p nil))))))
> Can you explain why restore-buffer-modified-p is preferred?

Because it avoids forcing a recomputation of the mode-line.

> The documentation suggests this may be suspicious.

But in the present case, restore-buffer-modified-p would indeed
restore the buffer-modified-p state, thus there's no need to recompute
the mode-line.

This was introduced specifically for this kind of use.  See for example
the definition of with-silent-modifications.


        Stefan



  reply	other threads:[~2015-09-16  1:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15 23:51 Get rid of verilog-no-change-functions Wilson Snyder
2015-09-16  1:05 ` Stefan Monnier [this message]
2015-09-16  7:40   ` Andreas Schwab
2015-09-16 13:12     ` Stefan Monnier
2015-10-29 13:22   ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2015-10-29 13:48 Wilson Snyder
2015-10-29 15:31 ` Stefan Monnier
2015-09-14 21:09 Wilson Snyder
2015-09-15 13:45 ` Stefan Monnier
2015-09-12 11:33 Wilson Snyder
2015-09-12 20:21 ` Stefan Monnier
2015-09-12  4:22 Stefan Monnier

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=jwvk2rrdwbi.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=wsnyder@wsnyder.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).