unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Move 'with-buffer-modified-unmodified' to simple.el
@ 2020-09-16 23:12 Yuan Fu
  2020-09-17  3:11 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Yuan Fu @ 2020-09-16 23:12 UTC (permalink / raw)
  To: emacs-devel

Currently it’s in bookmark.el. It seems to make more sense to be in simple.el or sub.el. WDYT?

Yuan





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

* Re: Move 'with-buffer-modified-unmodified' to simple.el
  2020-09-16 23:12 Move 'with-buffer-modified-unmodified' to simple.el Yuan Fu
@ 2020-09-17  3:11 ` Stefan Monnier
  2020-09-18 18:25   ` Yuan Fu
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2020-09-17  3:11 UTC (permalink / raw)
  To: Yuan Fu; +Cc: emacs-devel

> Currently it’s in bookmark.el.  It seems to make more sense to be in simple.el or sub.el.  WDYT?

Most use cases should be covered by `with-silent-modifications`, but
there might indeed be cases as in bookmark.el where the extra bindings
in `with-silent-modifications` aren't right.

Could you look through our code (e.g. with something like

    grep '(set-buffer-modified-p' **/*.el | grep -v 'd-p \(nil\|t\))'

) to see where we could use `with-silent-modifications` and where only
'with-buffer-modified-unmodified' can be used?


        Stefan




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

* Re: Move 'with-buffer-modified-unmodified' to simple.el
  2020-09-17  3:11 ` Stefan Monnier
@ 2020-09-18 18:25   ` Yuan Fu
  2020-09-18 19:56     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Yuan Fu @ 2020-09-18 18:25 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel



> On Sep 16, 2020, at 11:11 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> 
>> Currently it’s in bookmark.el.  It seems to make more sense to be in simple.el or sub.el.  WDYT?
> 
> Most use cases should be covered by `with-silent-modifications`, but
> there might indeed be cases as in bookmark.el where the extra bindings
> in `with-silent-modifications` aren't right.
> 
> Could you look through our code (e.g. with something like
> 
>    grep '(set-buffer-modified-p' **/*.el | grep -v 'd-p \(nil\|t\))'
> 
> ) to see where we could use `with-silent-modifications` and where only
> 'with-buffer-modified-unmodified' can be used?
> 
> 
>        Stefan
> 

How should we determine if the extra bindings in `with-silent-modifications’ aren’t right? In my understanding `with-silent-modifications’ should only be used when changing text properties and if you actually insert something you should use `with-buffer-modified-unmodified’. Is that correct?

Looking though the result of the grep, I see some text property changes and some content changes. But the content changes seems to appear in program-generated buffers so I’m not sure if `with-silent-modifications’ would do any harm anyway.

So, uh, maybe subr-x.el?

Yuan


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

* Re: Move 'with-buffer-modified-unmodified' to simple.el
  2020-09-18 18:25   ` Yuan Fu
@ 2020-09-18 19:56     ` Stefan Monnier
  2020-10-01 16:24       ` Yuan Fu
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2020-09-18 19:56 UTC (permalink / raw)
  To: Yuan Fu; +Cc: emacs-devel

> How should we determine if the extra bindings in `with-silent-modifications’
> aren’t right? In my understanding `with-silent-modifications’ should only be
> used when changing text properties and if you actually insert something you
> should use `with-buffer-modified-unmodified’. Is that correct?

I think so, yes.

> Looking though the result of the grep, I see some text property changes and
> some content changes.

How many cases (approximately) involve content changes?

> But the content changes seems to appear in program-generated buffers
> so I’m not sure if `with-silent-modifications’ would do any
> harm anyway.

`with-silent-modifications’ would prevent jit-lock from doing its job,
so it would interfere with the use (within that buffer) of any package
that depends on jit-lock, such as font-lock-mode, nlinum-mode,
nhexl-mode, goto-address-mode, bug-reference-mode, glasses-mode.


        Stefan




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

* Re: Move 'with-buffer-modified-unmodified' to simple.el
  2020-09-18 19:56     ` Stefan Monnier
@ 2020-10-01 16:24       ` Yuan Fu
  2020-10-01 16:51         ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Yuan Fu @ 2020-10-01 16:24 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel


> 
>> Looking though the result of the grep, I see some text property changes and
>> some content changes.
> 
> How many cases (approximately) involve content changes?


In total, about 33 content changes (c) and 9 property changes (p), 20 other cases (n), 7 that I don't understand (?).

lisp/allout-widgets.el          p (decorate)
lisp/allout-widgets.el          p
lisp/allout-widgets.el          p
lisp/allout.el                  c (encryption)
lisp/allout.el                  p (annotate)
lisp/arc-mode.el                c (archive summary)
lisp/autoinsert.el              c (insert default content)
lisp/bindings.el                ? (mode-line-toggle-modified?)
lisp/bookmark.el                n (with-buffer-modified-unmodified)
lisp/bookmark.el                c (insert)
lisp/buff-menu.el               n (set to non modify)
lisp/calc/calc-embed.el         n (update modeline)
lisp/calc/calc-embed.el         n (same)
lisp/calc/calc-embed.el         n (same)
lisp/calc/calc-embed.el         n (same)
lisp/calc/calc-embed.el         n (same)
lisp/calc/calc.el               n (same)
lisp/calc/calc.el               n (same)
lisp/dired-aux.el               c (rename)
lisp/dired-x.el                 c (omit)
lisp/ehelp.el                   c (erase-buffer)
lisp/emacs-lisp/cl-lib.el       n
lisp/emacs-lisp/testcover.el    p (overlay)
lisp/emulation/edt.el           ? ((set-buffer-modified-p t)?)
lisp/erc/erc.el                 c (prompt)
lisp/files.el                   c (insert)
lisp/format.el                  c (format file content)
lisp/gnus/gnus-group.el         n (update modeline)
lisp/help-mode.el               c (insert)
lisp/ibuffer.el                 ?
lisp/ibuffer.el                 n (toggle modify)
lisp/image-mode.el              p
lisp/international/kkc.el       c (convert)
lisp/international/quail.el     ?
lisp/international/quail.el     c (insert)
lisp/language/china-util.el     c (decode)
lisp/language/tibet-util.el     c
lisp/language/viet-util.el      c (decode)
lisp/leim/quail/uni-input.el    c
lisp/mail/feedmail.el           c (insert)
lisp/mh-e/mh-acros.el           n (macro)
lisp/mh-e/mh-folder.el          n (set)
lisp/mh-e/mh-mime.el            c
lisp/mh-e/mh-search.el          c
lisp/mh-e/mh-search.el          c
lisp/mh-e/mh-show.el            c
lisp/mh-e/mh-show.el            c
lisp/mh-e/mh-thread.el          c
lisp/mh-e/mh-thread.el          c
lisp/mh-e/mh-utils.el           c
lisp/mh-e/mh-xface.el           c
lisp/net/tramp-adb.el           c
lisp/net/tramp-cmds.el          ?
lisp/net/tramp-sh.el            ?
lisp/net/tramp-smb.el           ?
lisp/obsolete/fast-lock.el
lisp/obsolete/longlines.el
lisp/obsolete/longlines.el
lisp/obsolete/longlines.el
lisp/org/org-macs.el            p (org-unmodified)
lisp/org/org-src.el             c
lisp/org/org.el                 p
lisp/progmodes/idlwave.el       n (update modeline)
lisp/simple.el                  n undo
lisp/textmodes/ispell.el        p
lisp/textmodes/reftex-global.el n (update modeline)
lisp/type-break.el              n (auto save)
lisp/vc/ediff-ptch.el           n 
lisp/vc/ediff-util.el           c
nextstep/Emacs.app/Contents/Resources/lisp/mh-e/mh-acros.el     c

Yuan


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

* Re: Move 'with-buffer-modified-unmodified' to simple.el
  2020-10-01 16:24       ` Yuan Fu
@ 2020-10-01 16:51         ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2020-10-01 16:51 UTC (permalink / raw)
  To: Yuan Fu; +Cc: emacs-devel

>>> Looking though the result of the grep, I see some text property changes and
>>> some content changes.
>> How many cases (approximately) involve content changes?
> In total, about 33 content changes (c) and 9 property changes (p), 20 other
> cases (n), 7 that I don't understand (?).

Thanks.  So it looks like we have enough cases to justify such a macro.


        Stefan




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

end of thread, other threads:[~2020-10-01 16:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-16 23:12 Move 'with-buffer-modified-unmodified' to simple.el Yuan Fu
2020-09-17  3:11 ` Stefan Monnier
2020-09-18 18:25   ` Yuan Fu
2020-09-18 19:56     ` Stefan Monnier
2020-10-01 16:24       ` Yuan Fu
2020-10-01 16:51         ` Stefan Monnier

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).