unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 30186@debbugs.gnu.org, juri@linkov.net
Subject: bug#30186: 27.0.50; Password is not hidden in read-passwd
Date: Sat, 27 Jan 2018 11:37:13 +0000	[thread overview]
Message-ID: <20180127113713.GB4049@ACM> (raw)
In-Reply-To: <83r2qbk5bf.fsf@gnu.org>

Hello, Eli.

On Sat, Jan 27, 2018 at 11:40:36 +0200, Eli Zaretskii wrote:
> > Date: Fri, 26 Jan 2018 20:00:27 +0000
> > Cc: juri@linkov.net, 30186@debbugs.gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > Do you have any opinion on my suggestion:

> > > > Perhaps an alternative would be for Emacs to provide a flag which
> > > > indicates to a before/after-change-function whether the current
> > > > change is a "proper" change or merely a text property change.
> > > > Change hook functions could then test this flag and, for example,
> > > > refrain from doing anything for a text property change.

> I'm not sure it would be possible to provide such a flag.  Did you
> look at the internals involved, and if so, can you tell where do we
> know which kind of change caused the hooks to run?

I envisage adding an extra boolean argument to prepare_to_modify_buffer,
and to signal_after_change.  When called from the text property
routines, that argument would be true, otherwise it would be false.

The essence of this argument would be a guarantee that the change is not
going to alter the buffer text.  There may be other primitives besides
text properties for which we could set this argument.

> I also don't understand the problem you have in CC Mode with
> text-property changes.  Can you elaborate on that?

Yes.  In a largish CC Mode file, mark the entire buffer, kill-ring-save,
and append it after itself, with

    C-x h, M-w, M->, C-y

.  In buffer-undo-list there are no entries for text property changes.
Before the with-silent-modifications was put in, there were many such
entries.  Assume this in the next paragraph

Now undo this latest change with C-_.  Each of the entries for text
property changes wants to invoke CC Mode's
before/after-change-functions, which would make the operation slow.
(But see below.)

The workaround (currently in Emacs) for this, back in 2015, was to put
with-silent-modifications around the text property manipulations in
remove-yank-excluded-properties.  This prevents these manipulations
getting into the undo list, but also stops read-passwd from working
properly.

I now see there is a second workaround, in CC Mode itself, where
c-before-change and c-after-change use backtrace-frame to check the
primitive invoking them, and do nothing if that primitive is, e.g.,
put-text-property.  This is not an elegant workaround.

So, I'm changing my mind, after looking into it a bit more.  Removing
the with-silent-modifications from remove-yank-excluded-properties would
not slow down undo in CC Mode buffers noticeably.  It might slow down
other modes which make extensive use of before/after-change-functions.

The extra flag for the change hooks might still be a good idea.  It no
longer seems pertinent for solving the current bug, though.

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2018-01-27 11:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-20 21:29 bug#30186: 27.0.50; Password is not hidden in read-passwd Juri Linkov
2018-01-21 15:59 ` Eli Zaretskii
2018-01-21 21:19   ` Juri Linkov
2018-01-22 18:27     ` Glenn Morris
2018-01-22 18:45       ` Glenn Morris
2018-01-22 21:38         ` Juri Linkov
2018-01-23 21:38           ` Juri Linkov
2018-01-25 17:39             ` Alan Mackenzie
2018-01-25 21:15               ` Juri Linkov
2018-01-26 18:37                 ` Alan Mackenzie
2018-01-26 19:08                   ` Eli Zaretskii
2018-01-26 20:00                     ` Alan Mackenzie
2018-01-27  9:40                       ` Eli Zaretskii
2018-01-27 11:37                         ` Alan Mackenzie [this message]
2018-01-27 12:23                           ` Eli Zaretskii
2018-01-27 13:38                             ` Alan Mackenzie
2018-01-27 21:43                               ` Juri Linkov
2018-01-27 22:10                                 ` Alan Mackenzie
2018-01-27  8:27                   ` martin rudalics
2018-01-27  9:21                     ` Alan Mackenzie
2018-01-30  8:30                       ` martin rudalics
2018-01-22  1:53 ` Glenn Morris

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=20180127113713.GB4049@ACM \
    --to=acm@muc.de \
    --cc=30186@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    /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).