bug#72952: 30.0.90; Want way to break out of Eshell for loop

2024-09-02 Thread Sean Whitton
X-debbugs-cc: jporterb...@gmail.com

I am trying to run a series of tests like this:

% for test in tests/tests/tagupl* { tests/using-intree $test }

I want the command to give up as soon as one of the tests fails.  But I
don't think there is any way to break out of the loop?  In POSIX sh, you
could use 'break'.

Thanks.

-- 
Sean Whitton





bug#72953: 31.0.50; Error when calling gnus-summary-move-article

2024-09-02 Thread Bug reports for GNU Emacs, the Swiss army knife of text editors
Michael Heerdegen  writes:

> I am browsing the result of a `gnus-group-read-ephemeral-search-group'
> call.  Then I invoke `gnus-summary-move-article' (with point at the
> article I want to move) and get this error: [...]

Please ignore this one.  It was a hack in my config that caused this
problem.  Sorry for this distraction.


Michael.





bug#72954: 31.0.50; Error when calling gnus-summary-move-article

2024-09-02 Thread Bug reports for GNU Emacs, the Swiss army knife of text editors

Hello,

I am browsing the result of a `gnus-group-read-ephemeral-search-group'
call.  Then I invoke `gnus-summary-move-article' (with point at the
article I want to move) and get this error:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  (range-compress-list (nil))
  (gnus-compress-sequence (nil))
  (#f(compiled-function (artgroup) #) (nil nil))
  (mapcar #f(compiled-function (artgroup) #) ((nil 
nil)))
  (#f(compiled-function (act) #) ((2139) set nil))
  (mapcan #f(compiled-function (act) #) (((2139) 
set nil) ((2139) del (unexist seen forward unsend download cache save score 
dormant bookmark killed expire reply tick
  (cl-mapcan #f(compiled-function (act) #) 
(((2139) set nil) ((2139) del (unexist seen forward unsend download cache save 
score dormant bookmark killed expire reply tick
  (nnselect-request-set-mark "search->subject--bug--from---" (((2139) set nil) 
((2139) del (unexist seen forward unsend download cache save score dormant 
bookmark killed expire reply tick))) "nnselect-ephemeral")
  (gnus-request-set-mark "nnselect:search->subject--bug--from---" (((2139) set 
nil) ((2139) del (unexist seen forward unsend download cache save score dormant 
bookmark killed expire reply tick
  (gnus-summary-push-marks-to-backend 2139)
  (#f(compiled-function (&optional n to-newsgroup select-method action) "Move 
the current article to a different newsgroup.\nIf N is a positive number, move 
the N next articles.\nIf N is a negative number, move the N previous 
articles.\nIf N is nil and any articles have been marked with the process 
mark,\nmove those articles instead.\nIf TO-NEWSGROUP is string, do not prompt 
for a newsgroup to move to.\nIf SELECT-METHOD is non-nil, do not move to a 
specific newsgroup, but\nre-spool using this method.\n\nWhen called 
interactively with TO-NEWSGROUP being nil, the value of\nthe variable 
`gnus-move-split-methods' is used for finding a default\nfor the target 
newsgroup.\n\nFor this function to work, both the current newsgroup and 
the\nnewsgroup that you want to move to have to support the `request-move'\nand 
`request-accept' functions.\n\nACTION can be either `move' (the default), 
`crosspost' or `copy'." (interactive "P") #) nil)
  (funcall #f(compiled-function (&optional n to-newsgroup select-method action) 
"Move the current article to a different newsgroup.\nIf N is a positive number, 
move the N next articles.\nIf N is a negative number, move the N previous 
articles.\nIf N is nil and any articles have been marked with the process 
mark,\nmove those articles instead.\nIf TO-NEWSGROUP is string, do not prompt 
for a newsgroup to move to.\nIf SELECT-METHOD is non-nil, do not move to a 
specific newsgroup, but\nre-spool using this method.\n\nWhen called 
interactively with TO-NEWSGROUP being nil, the value of\nthe variable 
`gnus-move-split-methods' is used for finding a default\nfor the target 
newsgroup.\n\nFor this function to work, both the current newsgroup and 
the\nnewsgroup that you want to move to have to support the `request-move'\nand 
`request-accept' functions.\n\nACTION can be either `move' (the default), 
`crosspost' or `copy'." (interactive "P") #) nil)
  (#f(lambda (f n _) [cl-struct-my-gnus-summary-process-marked-tags 
cl-struct-my-gnus-summary-pos-tags t] (funcall f n)) #f(compiled-function 
(&optional n to-newsgroup select-method action) "Move the current article to a 
different newsgroup.\nIf N is a positive number, move the N next articles.\nIf 
N is a negative number, move the N previous articles.\nIf N is nil and any 
articles have been marked with the process mark,\nmove those articles 
instead.\nIf TO-NEWSGROUP is string, do not prompt for a newsgroup to move 
to.\nIf SELECT-METHOD is non-nil, do not move to a specific newsgroup, 
but\nre-spool using this method.\n\nWhen called interactively with TO-NEWSGROUP 
being nil, the value of\nthe variable `gnus-move-split-methods' is used for 
finding a default\nfor the target newsgroup.\n\nFor this function to work, both 
the current newsgroup and the\nnewsgroup that you want to move to have to 
support the `request-move'\nand `request-accept' functions.\n\nACTION can be 
either `move' (the default), `crosspost' or `copy'." (interactive "P") 
#) nil (2139))
  (funcall #f(lambda (f n _) [cl-struct-my-gnus-summary-process-marked-tags 
cl-struct-my-gnus-summary-pos-tags t] (funcall f n)) #f(compiled-function 
(&optional n to-newsgroup select-method action) "Move the current article to a 
different newsgroup.\nIf N is a positive number, move the N next articles.\nIf 
N is a negative number, move the N previous articles.\nIf N is nil and any 
articles have been marked with the process mark,\nmove those articles 
instead.\nIf TO-NEWSGROUP is string, do not prompt for a newsgroup to move 
to.\nIf SELECT-METHOD is non-nil, do not move to a specific newsgroup, 
but\nre-spool using this method.\n\nWhen called interactively with TO-NEWSGROUP 
being nil, the value of\nt

bug#72953: 31.0.50; Error when calling gnus-summary-move-article

2024-09-02 Thread Bug reports for GNU Emacs, the Swiss army knife of text editors
Michael Heerdegen  writes:

> Please ignore this one.  It was a hack in my config that caused this
> problem.  Sorry for this distraction.

Closing.

Michael.





bug#72954: 31.0.50; Error when calling gnus-summary-move-article

2024-09-02 Thread Bug reports for GNU Emacs, the Swiss army knife of text editors
Michael Heerdegen  writes:

> Hello,
>
> I am browsing the result of a `gnus-group-read-ephemeral-search-group'
> call.  Then I invoke `gnus-summary-move-article' (with point at the
> article I want to move) and get this error:

Closing, along with the duplicate I accidentally created.  The cause of
this issue was a misbehaving hack in my configuration.

Michael.





bug#72866: [PATCH] Add ediff-copy-all-X-to-Y functions

2024-09-02 Thread Robert Pluim
> On Sun, 1 Sep 2024 08:59:53 +0200, Paul Nelson  said:

>> > This patch binds functions in Ediff that copy all changes from one
>> > buffer to another, without having to manually go through each
>> > difference.  Any feedback welcome.
>> 
>> Can you describe situation(s) where these commands will be useful?

Paul> I use Ediff to merge documents outside of git, like when
Paul> working with someone over email or using a computer program to
Paul> refactor code.  Sometimes all changes go one way, say from B to A.
Paul> The standard workflow then involves pressing "n" to review and "b" to
Paul> apply each change.  When the changes turn out to be mundane, this
Paul> leads to repetitive "n b" keystrokes.  The proposed patch allows a
Paul> more efficient process: rapidly review with "n", then apply all at
Paul> once using "C-c C-b".

The functionality seems useful. I wonder if it makes more sense to
have them triggered by the prefix arg, eg "C-u b", "C-u a b",
etc. rather than having to keep Ctrl pressed.

Robert
-- 





bug#69097: [PATCH] Add 'kill-region-or-word' command

2024-09-02 Thread Eli Zaretskii
> From: Philip Kaludercic 
> Cc: Sean Whitton ,  j...@linkov.net,  r...@gnu.org,
>   69...@debbugs.gnu.org
> Date: Sun, 01 Sep 2024 20:06:00 +
> 
> Eli Zaretskii  writes:
> 
> >> From: Sean Whitton 
> >> Date: Mon, 06 May 2024 17:51:48 +0100
> >> 
> >> On Mon 06 May 2024 at 05:46pm +01, Sean Whitton wrote:
> >> >
> >> > In bash on Linux [...]
> >> 
> >> I specifically called out Linux because while GNU readline has a
> >> unix-word-rubout command, C-w in the Linux tty is actually implemented
> >> in the Linux-specific tty layer, below readline.
> >
> > Evidently, the above is inaccurate, because I see the same behavior in
> > Bash on MS-Windows.
> 
> Ping.  I am not sure how to proceed on this patch.  IIRC the issue was
> that the notion of a word differs in Emacs and in Bash.  I am still in
> favour of utilising Emacs's definition, as it remains more useful
> for some given major mode and the fact that it is easier to implement.

Or you could make the defcustom a tristate, and implement both
behaviors...

As for how to proceed: Stefan and Andrea, do you have an opinion on
this?





bug#72597: 30.0.60; Eglot: MarkedString with embedded Carriage Return

2024-09-02 Thread Eli Zaretskii
> From: Troy Brown 
> Date: Sun, 1 Sep 2024 16:49:04 -0400
> Cc: joaotav...@gmail.com, felician.nem...@gmail.com, 72...@debbugs.gnu.org
> 
> On Sat, Aug 31, 2024 at 3:55 AM Eli Zaretskii  wrote:
> >
> > Ping! How can we make progress with this issue?
> >
> 
> Just FYI, for the time being I've been using this "return filter"
> advice on eglot--format-markup which splits all lines irregardless of
> the EOL marker and rejoins them with a newline.  It's a bit
> heavy-handed, but it gets the job done.
> 
> (defun init.el/fix-eol/eglot--format-markup (value)
>   (let ((strings (list value)))
> (dolist (eol '("\r\n" "\n" "\r"))
>   (setq strings
> (flatten-list (mapcar (lambda (value)
> (split-string value eol))
>   strings
> (string-join strings "\n")))
> 
> (advice-add 'eglot--format-markup :filter-return
> #'init.el/fix-eol/eglot--format-markup)

Thanks, but isn't the above the same as setting the car of
process-coding-system for the Eglot subprocesses to 'dos'?





bug#72961: Possible documentation improvement: Clarification for package installation

2024-09-02 Thread Krystian Samp
Hello,

I was reading the section on "Libraries of Lisp Code for Emacs" (section
28.8) in the Emacs manual, and I encountered a passage that seems a bit
unclear. The text suggests that when using package-install, Emacs might
automatically add initialization code to the init.el file, which doesn’t
seem to match my experience.

Specifically, the manual states: "Installing a package using
package-install takes care of placing the package’s Lisp files in a
directory where Emacs will find it, and also writes the necessary
initialization code into your init files [...]"

>From my understanding, package-install does not modify init.el directly,
which is how I interpret the documentation above. Instead, Emacs calls
package-initialize which makes the installed packages available,
automatically.

I want to check if this is a valid concern / interpretation that warrants a
documentation change. If so, I'll be happy to create a patch.

Looking forward to your thoughts.
Krystian


bug#72960: 31.0.50; PGTK Wayland exhibits more lag than X11 version

2024-09-02 Thread Stephane Travostino
Heavy operations, such as scrolling back and forth in a buffer, are
noticeably laggier, for lack of better word, in the PGTK/Wayland version
than the X11, both tested on KDE in Wayland mode. 

Affects both 29.2 and the latest HEAD compiled a few days ago.

I am unsure whether it is a KDE or Emacs problem.

Running on an AMD RX 6800 XT graphics card on a HiDPI 4k screen at 2x
scaling.

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.43, cairo version 1.18.0) of 2024-08-29 built on
toolbox.tranquility
Repository revision: b6f4ffcc106fdbc21dfea45c75fdc4f217d8f201
Repository branch: makepkg
Windowing system distributor 'The X.Org Foundation', version 11.0.12401002
System Description: Arch Linux

Configured using:
'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
--localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
--with-modules --without-m17n-flt --without-gconf
--with-native-compilation=yes --with-xinput2 --with-sound=no
--with-tree-sitter --without-gpm --without-compress-install
'--program-transform-name=s/\([ec]tags\)/\1.emacs/'
'CFLAGS=-march=native -O2 -pipe -fno-plt -fexceptions
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
-fstack-clash-protection -fcf-protection'
LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  vertico-prescient-mode: t
  prescient-persist-mode: t
  marginalia-mode: t
  vertico-mode: t
  consult-notes-denote-mode: t
  denote-menu-bar-mode: t
  whole-line-or-region-global-mode: t
  whole-line-or-region-local-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  server-mode: t
  midnight-mode: t
  delete-selection-mode: t
  global-auto-revert-mode: t
  recentf-mode: t
  super-save-mode: t
  savehist-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  direnv-mode: t
  pulsar-global-mode: t
  pulsar-mode: t
  which-key-mode: t
  winner-mode: t
  pixel-scroll-precision-mode: t
  override-global-mode: t
  gcmh-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  transient-mark-mode: (only . t)
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/var/home/sph/.emacs.d/elpa/ef-themes-1.6.1/theme-loaddefs hides 
/var/home/sph/.emacs.d/elpa/modus-themes-20240826.647/theme-loaddefs
/var/home/sph/.emacs.d/elpa/which-key-20240620.2145/which-key hides 
/usr/share/emacs/31.0.50/lisp/which-key
/var/home/sph/.emacs.d/elpa/transient-20240821.158/transient hides 
/usr/share/emacs/31.0.50/lisp/transient
/var/home/sph/.emacs.d/elpa/ef-themes-1.6.1/theme-loaddefs hides 
/usr/share/emacs/31.0.50/lisp/theme-loaddefs
/var/home/sph/.emacs.d/elpa/bind-key-20230203.2004/bind-key hides 
/usr/share/emacs/31.0.50/lisp/bind-key
/var/home/sph/.emacs.d/elpa/use-package-20230426.2324/use-package hides 
/usr/share/emacs/31.0.50/lisp/use-package/use-package
/var/home/sph/.emacs.d/elpa/use-package-20230426.2324/use-package-lint hides 
/usr/share/emacs/31.0.50/lisp/use-package/use-package-lint
/var/home/sph/.emacs.d/elpa/use-package-20230426.2324/use-package-jump hides 
/usr/share/emacs/31.0.50/lisp/use-package/use-package-jump
/var/home/sph/.emacs.d/elpa/use-package-20230426.2324/use-package-ensure hides 
/usr/share/emacs/31.0.50/lisp/use-package/use-package-ensure
/var/home/sph/.emacs.d/elpa/use-package-20230426.2324/use-package-diminish 
hides /usr/share/emacs/31.0.50/lisp/use-package/use-package-diminish
/var/home/sph/.emacs.d/elpa/use-package-20230426.2324/use-package-delight hides 
/usr/share/emacs/31.0.50/lisp/use-package/use-package-delight
/var/home/sph/.emacs.d/elpa/use-package-20230426.2324/use-package-core hides 
/usr/share/emacs/31.0.50/lisp/use-package/use-package-core
/var/home/sph/.emacs.d/elpa/use-package-20230426.2324/use-package-bind-key 
hides /usr/share/emacs/31.0.50/lisp/use-package/use-package-bind-key
/usr/share/emacs/site-lisp/xscheme hides 
/usr/share/emacs/31.0.50/lisp/progmodes/xscheme
/var/home/sph/.emacs.d/elpa/idlwave-6.5.1/idlwave hides 
/usr/share/emacs/31.0.50/lisp/progmodes/idlwave
/var/home/sph/.emacs.d/elpa/idlwave-6.5.1/idlw-toolbar hides 
/usr/share/emacs/31.0.50/lisp/progmodes/idlw-toolbar
/var/home/sph/.emacs.d/elpa/idlwave-6.5.1/idlw-shell hides 
/usr/share/emacs/31.0.50/lisp/progmodes/idlw-shell
/var/home/sph/.emacs.d/elpa/idlwave-6.5.1/idlw-help hides 
/usr/share/emacs/31.0.50/lisp/progmodes/idlw

bug#72961: Possible documentation improvement: Clarification for package installation

2024-09-02 Thread Eli Zaretskii
> From: Krystian Samp 
> Date: Mon, 2 Sep 2024 12:41:11 +0200
> 
> I was reading the section on "Libraries of Lisp Code for Emacs" (section 
> 28.8) in the Emacs manual, and I
> encountered a passage that seems a bit unclear. The text suggests that when 
> using package-install, Emacs
> might automatically add initialization code to the init.el file, which 
> doesn’t seem to match my experience.
> 
> Specifically, the manual states: "Installing a package using package-install 
> takes care of placing the package’s
> Lisp files in a directory where Emacs will find it, and also writes the 
> necessary initialization code into your init
> files [...]"
> 
> From my understanding, package-install does not modify init.el directly, 
> which is how I interpret the
> documentation above. Instead, Emacs calls package-initialize which makes the 
> installed packages available,
> automatically.
> 
> I want to check if this is a valid concern / interpretation that warrants a 
> documentation change. If so, I'll be
> happy to create a patch.

Is package-quickstart.el considered "init file" or not?

And I add Philip to this discussion, as he knows the package.el code
better than I do.





bug#72945: 29.4; Org: ox-html: attr_html not supported in source code and fixed-width blocks during HTML export

2024-09-02 Thread Eli Zaretskii
> From: "Suhail Singh" 
> Date: Sun, 01 Sep 2024 20:55:08 -0400
> 
> 
> Since more than a month has gone by, I am creating this issue to ease
> tracking.  This issue was first mentioned in this post:
> .  Details
> cross-posted below.

Thanks, but why are you posting this here?  ox-html.el is part of Org,
and I don't see anything in the above discussion that indicates you
should post these patches to the Emacs bug-tracker.  What did I miss?





bug#72951: Hideshow support for treesitter

2024-09-02 Thread Eli Zaretskii
> From: Pranshu Sharma 
> Date: Mon, 2 Sep 2024 16:51:31 +1000
> 
> Are there any plans to add treesitter support for hideshow, it seems easy 
> enough to do and also very helpful,
> especially for langs that don't excessively use parens, such as python

I suggest to send this question to emacs-devel, not here.





bug#72960: 31.0.50; PGTK Wayland exhibits more lag than X11 version

2024-09-02 Thread Eli Zaretskii
> Date: Mon, 02 Sep 2024 10:18:03 +0100
> From: "Stephane Travostino" 
> 
> Heavy operations, such as scrolling back and forth in a buffer, are
> noticeably laggier, for lack of better word, in the PGTK/Wayland version
> than the X11, both tested on KDE in Wayland mode. 
> 
> Affects both 29.2 and the latest HEAD compiled a few days ago.
> 
> I am unsure whether it is a KDE or Emacs problem.
> 
> Running on an AMD RX 6800 XT graphics card on a HiDPI 4k screen at 2x
> scaling.

AFAIU, this is a problem with GTK input methods.  From PROBLEMS:

  *** Emacs built with GTK lags in its response to keyboard input.
  This can happen when input methods are used.  It happens because Emacs
  behaves in an unconventional way with respect to GTK input methods: it
  registers to receive keyboard input as unprocessed key events with
  metadata (as opposed to receiving them as text strings).  Most GTK
  programs use the latter approach, so some modern input methods have
  bugs and misbehave when faced with the way Emacs does it.

  A workaround is to set GTK_IM_MODULE=none in the environment, or maybe
  find a different input method without these problems.





bug#72945: 29.4; Org: ox-html: attr_html not supported in source code and fixed-width blocks during HTML export

2024-09-02 Thread Suhail Singh
Eli Zaretskii  writes:

> Thanks, but why are you posting this here?  ox-html.el is part of Org,

My reasoning was that Org is a part of Emacs, so debbugs would be
appropriate.  Or at least, that it would _not be inappropriate_.
Perhaps I was mistaken.

> and I don't see anything in the above discussion that indicates you
> should post these patches to the Emacs bug-tracker.  What did I miss?

There was no normative expectation to report these to debbugs, i.e., I
am doing so of my own volition.  Reading between the lines of your
response, however, it seems debbugs may not be the right place for it.
If so, apologies for the noise; especially if this was documented
somewhere and I missed it.

My intent was to have a reliable reference that I could either subscribe
to or check semi-regularly, to understand the status of the issue.
Specifically, if/when the issue gets resolved, I'd like to know without
having to monitor all the commits in the Org repository.

I understand that Org uses some custom mailing list software ("Woof!")
to help with tracking issues.  However, it's not clear whether that is
exclusively the case (i.e., debbugs is not to be used for Org issues).
On a related note, "Woof!" doesn't list the issue under "Bugs" and I
don't quite understand why:
.

In any case, thank you for taking the time to look into this.

-- 
Suhail





bug#72597: 30.0.60; Eglot: MarkedString with embedded Carriage Return

2024-09-02 Thread João Távora
On Mon, Sep 2, 2024 at 12:24 PM Eli Zaretskii  wrote:

> > (advice-add 'eglot--format-markup :filter-return
> > #'init.el/fix-eol/eglot--format-markup)
>
> Thanks, but isn't the above the same as setting the car of
> process-coding-system for the Eglot subprocesses to 'dos'?

If that works consistently across all OSs and servers, it's
a much better idea.  I don't know how this works in terms of
jsonrpc.el though. I hope it doesn't mess up the byte count
of JSON objects transmitted back and forth, and only affects
how we interpret strings inside those JSON objects. AFAIR
the buffer where we do the JSON deserialization is in utf-8,
but it uses position-bytes for everything.

Anyway, if the solution is to be performed at this lower
level (which I think it should), then Daniel Petterson
jsonrpc.el maintainer should be added.

João





bug#72945: 29.4; Org: ox-html: attr_html not supported in source code and fixed-width blocks during HTML export

2024-09-02 Thread Eli Zaretskii
> From: Suhail Singh 
> Cc: "Suhail Singh" ,  72...@debbugs.gnu.org
> Date: Mon, 02 Sep 2024 08:26:07 -0400
> 
> Eli Zaretskii  writes:
> 
> > Thanks, but why are you posting this here?  ox-html.el is part of Org,
> 
> My reasoning was that Org is a part of Emacs, so debbugs would be
> appropriate.  Or at least, that it would _not be inappropriate_.
> Perhaps I was mistaken.

Org has its own bug tracker and mailing list to discuss problems
specific to Org.  So I suggest to report this there.

> I understand that Org uses some custom mailing list software ("Woof!")
> to help with tracking issues.  However, it's not clear whether that is
> exclusively the case (i.e., debbugs is not to be used for Org issues).
> On a related note, "Woof!" doesn't list the issue under "Bugs" and I
> don't quite understand why:
> .

The general advice is to post Org problems to the Org forums first,
and only come here if the Org developers decide that the underlying
problem is a general Emacs problem, not a problem in Org.





bug#72960: 31.0.50; PGTK Wayland exhibits more lag than X11 version

2024-09-02 Thread Stephane Travostino
On Mon, 2 Sep 2024, at 13:05, Eli Zaretskii wrote:
>> Date: Mon, 02 Sep 2024 10:18:03 +0100
>> From: "Stephane Travostino" 
>> 
>> Heavy operations, such as scrolling back and forth in a buffer, are
>> noticeably laggier, for lack of better word, in the PGTK/Wayland version
>> than the X11, both tested on KDE in Wayland mode. 
>> 
>> Affects both 29.2 and the latest HEAD compiled a few days ago.
>> 
>> I am unsure whether it is a KDE or Emacs problem.
>> 
>> Running on an AMD RX 6800 XT graphics card on a HiDPI 4k screen at 2x
>> scaling.
>
> AFAIU, this is a problem with GTK input methods.  From PROBLEMS:
>
>   *** Emacs built with GTK lags in its response to keyboard input.
>   This can happen when input methods are used.  It happens because Emacs
>   behaves in an unconventional way with respect to GTK input methods: it
>   registers to receive keyboard input as unprocessed key events with
>   metadata (as opposed to receiving them as text strings).  Most GTK
>   programs use the latter approach, so some modern input methods have
>   bugs and misbehave when faced with the way Emacs does it.
>
>   A workaround is to set GTK_IM_MODULE=none in the environment, or maybe
>   find a different input method without these problems.

Thank you, though without more scientific methods of measuring latency I can't 
tell if that helps or not. 

I noticed I had pixel precision scrolling mode on and that contributed a large 
part to that feeling of lag compared to other programs. If Firefox is able to 
smooth scroll at 60 Hz, I would say empirically Emacs PGTK would scroll at 15 
Hz, making navigation in the buffer a choppy affair. 





bug#72966: 30.0.90; [PATCH] php-ts-mode: custom php.ini config for the built-in php webserver

2024-09-02 Thread Vincenzo Pupillo
Ciao, 
this patch adds a new CONFIG attribute to 'php-ts-mode-run-php-webserver' that 
allows you to specify an alternative php.ini file to the default (or whatever 
is specified in 'php-ts-mode-php-config').
Thanks.

Vincenzo.

>From 8b64219e081a086559728251172d710b51e2 Mon Sep 17 00:00:00 2001
From: Vincenzo Pupillo 
Date: Mon, 2 Sep 2024 14:11:01 +0200
Subject: [PATCH] Support for custom php.ini for the built-in PHP web server.

A new CONFIG attribute, which defaults to 'php-ts-mode-php-config',
allows an alternative php.ini file to be specified for the built-in web
server. The 'php-ts-mode-run-php-webserver' function, when called
interactively with a prefix argument, also requires this new attribute.

* lisp/progmodes/php-ts-mode.el (php-ts-mode-run-php-webserver):
New CONFIG attribute. Update docstring.
* lisp/progmodes/php-ts-mode.el (php-ts-mode--webserver-read-args):
Support the new TYPE. Update docstring.
---
 lisp/progmodes/php-ts-mode.el | 33 ++---
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el
index 3f89de14075..34304049c5c 100644
--- a/lisp/progmodes/php-ts-mode.el
+++ b/lisp/progmodes/php-ts-mode.el
@@ -1469,8 +1469,12 @@ php-ts-mode
 
 
 ;;;###autoload
-(defun php-ts-mode-run-php-webserver (&optional port hostname document-root
-router-script num-of-workers)
+(defun php-ts-mode-run-php-webserver (&optional port
+hostname
+document-root
+router-script
+config
+num-of-workers)
   "Run PHP built-in web server.
 
 PORT: Port number of built-in web server, default `php-ts-mode-ws-port'.
@@ -1482,12 +1486,14 @@ php-ts-mode-run-php-webserver
 Prompt for the document-root if the default value is nil.
 ROUTER-SCRIPT: Path of the router PHP script,
 see `https://www.php.net/manual/en/features.commandline.webserver.php'
+CONFIG: Alternative php.ini config, default `php-ts-mode-php-config'.
 NUM-OF-WORKERS: Before run the web server set the
 PHP_CLI_SERVER_WORKERS env variable useful for testing code against
 multiple simultaneous requests.
 
+
 Interactively, when invoked with prefix argument, always prompt
-for PORT, HOSTNAME, DOCUMENT-ROOT and ROUTER-SCRIPT."
+for PORT, HOSTNAME, DOCUMENT-ROOT, ROUTER-SCRIPT and CONFIG."
   (interactive (when current-prefix-arg
  (php-ts-mode--webserver-read-args)))
   (let* ((port (or
@@ -1502,6 +1508,9 @@ php-ts-mode-run-php-webserver
  document-root
  php-ts-mode-ws-document-root
  (php-ts-mode--webserver-read-args 'document-root)))
+ (config (or config
+ (when php-ts-mode-php-config
+   (expand-file-name php-ts-mode-php-config
  (host (format "%s:%d" hostname port))
  (name (format "PHP web server on: %s" host))
  (buf-name (format "*%s*" name))
@@ -1509,6 +1518,8 @@ php-ts-mode-run-php-webserver
 nil
 (list "-S" host
   "-t" document-root
+  (when config
+			(format "-c %s" config))
   router-script)))
  (process-environment
   (cons (cond
@@ -1529,8 +1540,8 @@ php-ts-mode-run-php-webserver
 
 (defun php-ts-mode--webserver-read-args (&optional type)
   "Helper for `php-ts-mode-run-php-webserver'.
-The optional TYPE can be the symbol \"port\", \"hostname\", \"document-root\" or
-\"router-script\", otherwise it requires all of them."
+The optional TYPE can be the symbol \"port\", \"hostname\", \"document-root\",
+\"router-script\" or \"config\", otherwise it requires all of them."
   (let ((ask-port (lambda ()
 (read-number "Port: " 3000)))
 (ask-hostname (lambda ()
@@ -1546,17 +1557,25 @@ php-ts-mode--webserver-read-args
   (read-file-name "Router script: "
   (file-name-directory
(or (buffer-file-name)
-   default-directory)))
+   default-directory))
+(ask-config (lambda()
+  (expand-file-name
+   (read-file-name "Alternative php.ini: "
+   (file-name-directory
+(or (buffer-file-name)
+default-directory)))
 (cl-case type
   (port (funcall ask-port))
   (hostname (funcall ask-hostname))
   (document-root (funcall ask-document-root))
   (router-script (funcall ask-route

bug#72966: 30.0.90; [PATCH] php-ts-mode: custom php.ini config for the built-in php webserver

2024-09-02 Thread Eli Zaretskii
> From: Vincenzo Pupillo 
> Date: Mon, 02 Sep 2024 15:29:23 +0200
> 
> Ciao, 
> this patch adds a new CONFIG attribute to 'php-ts-mode-run-php-webserver' 
> that 
> allows you to specify an alternative php.ini file to the default (or whatever 
> is specified in 'php-ts-mode-php-config').

Thanks.

> -(defun php-ts-mode-run-php-webserver (&optional port hostname document-root
> -router-script num-of-workers)
> +(defun php-ts-mode-run-php-webserver (&optional port
> +hostname
> +document-root
> +router-script
> +config
> +num-of-workers)
>"Run PHP built-in web server.

This changes a public API in backward-incompatible way, something we
don't do, because it could break someone's code out there.  (It is
true that php-ts-mode was introduced in Emacs 30, but that version is
already in pretest and will be released soon, so I don't think we can
change this there, either.)

So please find a backward-compatible way of adding this feature,
perhaps add the new CONFIG argument as the last one?

Also, I think this needs a NEWS entry describing the change in
behavior.





bug#72966: 30.0.90; [PATCH] php-ts-mode: custom php.ini config for the built-in php webserver

2024-09-02 Thread Vincenzo Pupillo
Ok, thanks. 
I will fix ASAP.

Vincenzo.

In data lunedì 2 settembre 2024 16:23:53 CEST, Eli Zaretskii ha scritto:
> > From: Vincenzo Pupillo 
> > Date: Mon, 02 Sep 2024 15:29:23 +0200
> > 
> > Ciao,
> > this patch adds a new CONFIG attribute to 'php-ts-mode-run-php-webserver'
> > that allows you to specify an alternative php.ini file to the default (or
> > whatever is specified in 'php-ts-mode-php-config').
> 
> Thanks.
> 
> > -(defun php-ts-mode-run-php-webserver (&optional port hostname
> > document-root -   
> > router-script num-of-workers) +(defun php-ts-mode-run-php-webserver
> > (&optional port
> > +hostname
> > +document-root
> > +router-script
> > +config
> > +num-of-workers)
> > 
> >"Run PHP built-in web server.
> 
> This changes a public API in backward-incompatible way, something we
> don't do, because it could break someone's code out there.  (It is
> true that php-ts-mode was introduced in Emacs 30, but that version is
> already in pretest and will be released soon, so I don't think we can
> change this there, either.)
> 
> So please find a backward-compatible way of adding this feature,
> perhaps add the new CONFIG argument as the last one?
> 
> Also, I think this needs a NEWS entry describing the change in
> behavior.









bug#72992: 29.4; towards xoauth2 support in Emacs

2024-09-02 Thread Xiyue Deng
Now that bug#72358 is done, as promised, I'm posting my plugin for
auth-sources that enables oauth2 handling which you can find on
Gitlab[1] (also attached).  As the current approach tries to override
some existing handling in auth-source, I would like to gather some
comments on how to properly integrate this handling, and see if there is
any benefit on providing this as a separate package for older Emacs
versions.

In the comment section of the package I put notes on how xoauth2 is
enabled as well as existing restrictions in auth-source and how it
workarounds them.  I'll briefly explain below.

Currently, auth-source search requires that the result include `:secret'
most of the time, where when using xoauth2 it is actually the
access-token. Actually, auth-source has existing support for xoauth2
authentication, though it assumes that the password value actually
stores the access-token.  Because xoauth2 also makes use of
`secret'/`password', it makes it hard to determine whether to use
password-based or xoauth2-based authentication, which is why my plugin
asks users to set `auth' in auth-source to determine whether to use
xoauth2.  Another complication from this is that auth-source search
requires the entry contains a `secret' most of the time, where it does
not need to be set when using xoauth2.  Therefore I workaround this by
temporarily disables this check and try to retrieve access-token using
oauth2 and set the result as password.

Given the inconveniences of reusing password for access-token, I wonder
whether we can add support for a separate `:access-token' key in the
auth-source entry and use that instead of password when authenticating
using xoauth2.  This way, we can have both password and access-token in
an auth-source entry and nnimap and smtpmail can use either one.  More
specifically:

* When performing an auth-source search, if xoauth2 related fields are
  set (see the list of fields in the comments of my plugin), it will
  retrieve access-token using oauth2.

* The search should change to check for either `secret'/`password' or
  `access-token' is available.

* For `nnimap-login' and `smtpmail-try-auth-method', pass in both
  password and access-token, and for xoauth2 it should use access-token
  instead of password.

If this is an acceptable approach, I'll try to draft a patch to
implement this in Emacs.  Otherwise, it may still worth implement the
current approach directly in Emacs so as to avoid using hack like
advice.

Meanwhile, I wonder whether this may be worth release as a separate
package so that users of older versions can use xoauth2 as well.  I'd
like to make it compatible with the agreed-upon approach to minimize any
incompatibilities.

Thanks for reading, and any comments are appreciated.

[1] https://gitlab.com/xiyueden/auth-source-xoauth2-plugin


In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
 cairo version 1.16.0) of 2024-07-02, modified by Debian built on
 debian-hx90
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.4/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.4/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --with-cairo --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/emacs-UNWIcy/emacs-29.4+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2
XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  mu4e-modeline-mode: t
  windmove-mode: t
  rcirc-track-minor-mode: t
  server-mode: t
  subword-mode: t
  bug-reference-prog-mode: t
  whitespace-mode: t
  yas-minor-mode: t
  xclip-mode: t
  global-treesit-auto-mode: t
  treemacs-pro

bug#72977: 28.2; DOS in Shell-script mode

2024-09-02 Thread Chris Moore
I've been seeing Emacs hang up repeatedly for no apparent reason recently
while editing shell scripts. I spent the time to isolate the issue. It
turns out that I can reproduce the issue by opening a new shell script file
and typing the word "in" 20 or 30 times on a single line:

$ emacs -Q
C-x C-f /tmp/x.sh
echo in in in in in in in in in in in in in in in in in in in in in in in
in in in in in in in

After about 20 'in's, things slow down noticeably, and I can't get to 30
without it hanging.

I fixed the issue by replacing "in" with "'in'" in my script.


In GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
cairo version 1.16.0)
 of 2024-06-25, modified by Debian built on x86-conova-01
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --with-cairo --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/reproducible-path/emacs-28.2+1=.
-fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_CA.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Shell-script

Minor modes in effect:
  sh-electric-here-document-mode: t
  display-time-mode: t
  global-so-long-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny rfc822 mml mml-sec epa
derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs time-date
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail comp comp-cstr warnings cl-extra help-mode rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils sh-script smie
executable dired-aux term/screen term/xterm xterm cus-edit pp cus-start
wid-edit ido time cus-load wdired dired dired-loaddefs so-long shell
pcomplete rust-utils thingatpt rust-mode rx rust-rustfmt rust-playpen
rust-compile compile text-property-search comint ansi-color ring
rust-cargo finder-inf package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl
tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 199366 8596)
 (symbols 48 13308 1)
 (strings 32 65460 2058)
 (string-bytes 1 1538163)
 (vectors 16 2

bug#72210: 31.0.50; Feature request: multi-category support in `icomplete-fido-kill'.

2024-09-02 Thread Fernando de Morais
Hello Stefan,

Stefan Monnier  writes:

>> `icomplete-fido-kill' works very well, but cannot handle the deletion of
>> files or killing buffers when they are behind a multi-category
>> ``situation''.  Add this would be useful for those of us that combine
>> `icomplete' with, e.g., `consult-buffer'.
>
> Can you provide a recipe?  I'm not sufficiently familiar with that code
> to really understand the problem you're facing.

Sure!

Please, install the `consult' package and, in an emacs -Q session,
evaluate the following:

#+begin_src emacs-lisp
(progn
  (package-initialize)
  (load-library "consult")
  (icomplete-vertical-mode t)
  (keymap-set icomplete-minibuffer-map "C-k" 'icomplete-fido-kill))
#+end_src

- Then, ``M-x consult-buffer'';
- Type *M (this should turn the `*Messages*' buffer the current
  candidate);
- Then ``C-k''

The following message should appear in the minibuffer:

[Sorry, don’t know how to kill things for ‘multi-category’]

The same happens when we try to use `icomplete-fido-kill' in files
listed by `consult-buffer'.

The expected result would be for `icomplete-fido-kill' to work normally,
killing the buffer, even though it is listed by `consult-buffer'.

>> What follows is just the ``hacky'' approach that's currently being used
>> in my init:
>
> Any chance you can make it a patch against `icomplete.el`?

Follows attached!  This is my first patch, so I might have made
mistakes, but I'm here to adjust whatever you deem necessary.

-- 
Regards,
Fernando de Morais.
>From 7fd715580d70d1c7cb7dbbe3035a439c4d06c49d Mon Sep 17 00:00:00 2001
From: Fernando de Morais 
Date: Mon, 2 Sep 2024 13:14:04 -0300
Subject: [PATCH] Add support for multi-category to icomplete-fido-kill

* etc/NEWS: Announce the multi-category support in 'icomplete-fido-kill'.
* lisp/icomplete.el (icomplete--refine-multi-category): New function.
(icomplete-fido-kill): Apply the helper function to refine
'multi-category' to its actual type.
---
 etc/NEWS  |  7 +++
 lisp/icomplete.el | 16 ++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 1e66f084117..86c2995cf19 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -65,6 +65,13 @@ different values for completion-affecting variables like
 applies for the styles configuration in 'completion-category-overrides'
 and 'completion-category-defaults'.
 
+** Icomplete
+
+---
+*** 'icomplete-fido-kill' now works within multi-category environments.
+This function can now delete a file or kill a buffer within a
+multi-category environment, such as 'consult-buffer'.
+
 ** Windows
 
 +++
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 2ea5e36fa88..1ef861ff270 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -317,6 +317,16 @@ Return non-nil if something was stepped."
 
 ;;;_* Helpers for `fido-mode' (or `ido-mode' emulation)
 
+(defun icomplete--refine-multi-category (target)
+  "Refine `multi-category' TARGET to its actual type."
+  (or (let ((mc (get-text-property 0 'multi-category target)))
+(cond
+ ;; The `cdr' of the `multi-category' property can be a buffer object.
+ ((and (eq (car mc) 'buffer) (buffer-live-p (cdr mc)))
+  	(cons 'buffer (buffer-name (cdr mc
+ ((stringp (cdr mc)) mc)))
+  (cons 'general target)))
+
 (defun icomplete-fido-kill ()
   "Kill line or current completion, like `ido-mode'.
 If killing to the end of line make sense, call `kill-line',
@@ -330,8 +340,10 @@ require user confirmation."
 (if (< (point) end)
 (call-interactively 'kill-line)
   (let* ((all (completion-all-sorted-completions))
- (thing (car all))
- (cat (icomplete--category))
+ (refined-pair (when (eq 'multi-category (icomplete--category))
+ (icomplete--refine-multi-category (car all
+ (cat (or (car-safe refined-pair) (icomplete--category)))
+ (thing (or (cdr-safe refined-pair) (car all)))
  (action
   (cl-case cat
 (buffer
-- 
2.46.0



bug#72977: 28.2; DOS in Shell-script mode

2024-09-02 Thread Eli Zaretskii
> From: Chris Moore 
> Date: Mon, 2 Sep 2024 12:35:18 -0300
> 
> I've been seeing Emacs hang up repeatedly for no apparent reason recently 
> while editing shell scripts. I spent
> the time to isolate the issue. It turns out that I can reproduce the issue by 
> opening a new shell script file and
> typing the word "in" 20 or 30 times on a single line:
> 
> $ emacs -Q
> C-x C-f /tmp/x.sh
> echo in in in in in in in in in in in in in in in in in in in in in in in in 
> in in in in in in
> 
> After about 20 'in's, things slow down noticeably, and I can't get to 30 
> without it hanging.

The profile is below.  Maybe Stefan (CC'ed) has some comments or
suggestions.

   36361  58% - timer-event-handler
   36361  58%  - apply
   36361  58%   - show-paren-function
   36361  58%- #
   36361  58% - apply
   36361  58%  - smie--matching-block-data
   36359  58%   - smie--opener/closer-at-point
   36068  57%- sh-smie-sh-forward-token
   23841  38% - sh-smie--sh-keyword-p
   23841  38%  - sh-smie--sh-keyword-in/do-p
   23841  38%   - sh-smie-sh-backward-token
   23837  38%- sh-smie--sh-keyword-p
   23837  38% - sh-smie--sh-keyword-in/do-p
   23837  38%  - sh-smie-sh-backward-token
   23805  38%   - sh-smie--sh-keyword-p
   23801  38%- sh-smie--sh-keyword-in/do-p
   23793  38% - sh-smie-sh-backward-token
   23685  38%  - sh-smie--sh-keyword-p
   23681  38%   - sh-smie--sh-keyword-in/do-p
   23665  37%- sh-smie-sh-backward-token
   23425  37% - sh-smie--sh-keyword-p
   23409  37%  - sh-smie--sh-keyword-in/do-p
   23349  37%   - sh-smie-sh-backward-token
   13623  21%  looking-back
6152   9%  sh-smie--default-backward-token
3368   5%- sh-smie--sh-keyword-p
1655   2%   sh-smie--sh-keyword-in/do-p
  28   0% assoc
 136   0%   looking-back
  44   0%   sh-smie--default-backward-token
   8   0%  assoc
  64   0%looking-back
  20   0%sh-smie--default-backward-token
   4   0%   assoc
  16   0% sh-smie--default-backward-token
   8   0% looking-back
   4   0%  sh-smie--default-backward-token
   12227  19% - sh-smie--newline-semi-p
   12227  19%  - sh-smie-sh-backward-token
   12227  19%   - sh-smie--sh-keyword-p
   12227  19%- sh-smie--sh-keyword-in/do-p
   12227  19% - sh-smie-sh-backward-token
   12227  19%  - sh-smie--sh-keyword-p
   12227  19%   - sh-smie--sh-keyword-in/do-p
   12227  19%- sh-smie-sh-backward-token
   12223  19% - sh-smie--sh-keyword-p
   12223  19%  - sh-smie--sh-keyword-in/do-p
   12223  19%   - sh-smie-sh-backward-token
   12203  19%- sh-smie--sh-keyword-p
   12203  19% - sh-smie--sh-keyword-in/do-p
   12199  19%  - sh-smie-sh-backward-token
   12143  19%   - sh-smie--sh-keyword-p
   12143  19%- sh-smie--sh-keyword-in/do-p
   10012  16%   sh-smie-sh-backward-token
2119   3%   assoc
  36   0% looking-back
 [...]
   25633  41%   Automatic GC





bug#72359: treesit-node-at-point bug on vhdl-ts-mode after update to 0.22.6

2024-09-02 Thread Yuan Fu



> On Aug 29, 2024, at 5:07 AM, Eli Zaretskii  wrote:
> 
>> Cc: 72...@debbugs.gnu.org
>> From: Yuan Fu 
>> Date: Tue, 27 Aug 2024 01:22:42 -0700
>> 
>> Thank you for your report, Gonzalo! And sorry for the delay. I properly 
>> looked into this today, and confirmed that this is a tree-sitter bug. I 
>> raised an issue here: https://github.com/tree-sitter/tree-sitter/issues/3555
>> 
>> Sadly, there’s not much we can do right now. There was another similar bug 
>> in tree-sitter, which I worked around by using another function. But now 
>> that “another function” is also broken, oh well :-(
> 
> Since this is not an Emacs bug, I'm closing it.

FYI tree-sitter devs have fixed the bug: 
https://github.com/tree-sitter/tree-sitter/issues/3555

Yuan




bug#72951: Hideshow support for treesitter

2024-09-02 Thread Juri Linkov
> Are there any plans to add treesitter support for hideshow, it seems easy
> enough to do and also very helpful, especially for langs that don't
> excessively use parens, such as python

There is already treesitter support for outline-minor-mode,
so you could look into implementation to do something similar.





bug#72983: 29.4; Inconsistent parameter types sent to GUI selection converters

2024-09-02 Thread Bug reports for GNU Emacs, the Swiss army knife of text editors



Existing code
-

We'll have to go into some obscure areas of the GUI selection 
code.

Let's start with xselect-convert-to-targets (select.el).

 (defun xselect-convert-to-targets (selection _type value)
   ;; Return a vector of atoms, but remove duplicates first.
   (if (eq selection 'XdndSelection)
   ;; This isn't required by the XDND protocol, and sure 
   enough no
   ;; clients seem to dependent on it, but Emacs implements 
   the
   ;; receiver side of the Motif drop protocol by looking at 
   the
   ;; initiator selection's TARGETS target (which Motif 
   provides)
   ;; instead of the target table on the drag window, so it 
   seems

   ;; plausible for other clients to rely on that as well.
   (apply #'vector (mapcar #'intern x-dnd-targets-list))
 (apply #'vector
(delete-dups
 `( TIMESTAMP MULTIPLENIL
. ,(delq '_EMACS_INTERNAL
 (mapcar (lambda (conv)
   (if (or (not (consp (cdr 
   conv)))
   (funcall (cadr conv) 
   selection
(car conv) 
value))

   (car conv)
 '_EMACS_INTERNAL))
 selection-converter-alist)))

This function evaluates each converter in 
selection-converter-alist
against the selection value, and returns the labels of any 
converters
that return non-NIL.  The goal here is to filter out targets that 
Emacs
can't vend for the current value.  The converters are responsible 
for

noticing and rejecting inputs that they can't support.

Be aware that the "value" parameter may be a string with text
properties.  The "gui-set-selection" Info documentation mentions 
this:


If DATA is a string, then its text properties can specify 
values

used for individual data types.  For example, if DATA has a
property named ‘text/uri-list’, then a call to 
‘gui-get-selection’
with the data type ‘text/uri-list’ will result in the value 
of that

property being used instead of DATA itself.

Now compare the xselect-convert-to-targets function with the code 
in

x_get_local_selection (xselect.c, excerpted).

 CHECK_SYMBOL (target_type);
 handler_fn = CDR (Fassq (target_type, 
 Vselection_converter_alist));


 if (CONSP (handler_fn))
handler_fn = XCDR (handler_fn);

 if (!need_alternate)
tem = XCAR (XCDR (local_value));
 else
tem = XCAR (XCDR (XCDR (XCDR (XCDR (local_value);

 if (STRINGP (tem))
{
  local_value = Fget_text_property (make_fixnum (0),
target_type, tem);

  if (!NILP (local_value))
tem = local_value;
}

 if (!NILP (handler_fn))
value = call3 (handler_fn, selection_symbol,
   ((local_request
			 && NILP 
			 (Vx_treat_local_requests_remotely))

? Qnil
: target_type),
   tem);
 else
value = Qnil;

The caller (possibly another X client) provides the target, which
defines the converter to use.  If tem is a string, then we check 
for a
property that matches the target type.  If such a property exists, 
we
clobber the existing string with the associated property's object. 
Then

we call the converter.


Problem
---

This discrepancy trips up potential HTML support.

A typical application like Firefox or LibreOffice vends both 
text/html
and text/plain content.  Clients will ask for the targets, then 
ask
for the text/html value if available, falling back to text/plain. 
For

example, we might want to support an italiced "foo", while falling
back to the underlying word.

 #("foo" 0 3 (text/html "foo"))

We want to advertise a text/html target only when our value has a
text/html property.  We can do that with new 
"xselect-convert-to-html"

function in selection-converter-alist.

 (text/html . xselect-convert-to-html)

The function returns true if the input is a string with a 
text/html
property.  But if the client then *asks* for the text/html, the C 
code
will send the same function a plain string “foo” without 
the
property.  The function bails out with NIL.  Most clients will 
then fall

back and ask for the text/plain target.

In broad terms, we can’t distinguish between regular text and HTML 
text
from first principles.  We need guidance from upstream.  Also note 
that
if we write the HTML converter function such that it doesn’t test 
for
and require that text/html property, then Emacs will happily vend 
the

plain text strings to text/html requesters.


Possible fixes
--

The current implementation doesn't nail down th

bug#69097: [PATCH] Add 'kill-region-or-word' command

2024-09-02 Thread Stefan Kangas
Eli Zaretskii  writes:

>> From: Philip Kaludercic 
>> Cc: Sean Whitton ,  j...@linkov.net,  r...@gnu.org,
>>   69...@debbugs.gnu.org
>> Date: Sun, 01 Sep 2024 20:06:00 +
>>
>> Ping.  I am not sure how to proceed on this patch.  IIRC the issue was
>> that the notion of a word differs in Emacs and in Bash.  I am still in
>> favour of utilising Emacs's definition, as it remains more useful
>> for some given major mode and the fact that it is easier to implement.
>
> Or you could make the defcustom a tristate, and implement both
> behaviors...
>
> As for how to proceed: Stefan and Andrea, do you have an opinion on
> this?

Binding C-w to backward-kill-word, or some version thereof, is an old
Emacs power user trick that has been recommended in many places over the
years.  See, for example:
https://sites.google.com/site/steveyegge2/effective-emacs#h.p_ID_193
https://emacs-fu.blogspot.com/2009/11/copying-lines-without-selecting-them.html

So I think this command would be a good addition.  Making the word
boundary behaviour into a tristate option sounds like a reasonable way
forward, which should make everyone happy and let people experiment with
what works best for them.





bug#69097: [PATCH] Add 'kill-region-or-word' command

2024-09-02 Thread Sean Whitton
Hello,

On Mon 02 Sep 2024 at 11:30am -07, Stefan Kangas wrote:

> Binding C-w to backward-kill-word, or some version thereof, is an old
> Emacs power user trick that has been recommended in many places over the
> years.  See, for example:
> https://sites.google.com/site/steveyegge2/effective-emacs#h.p_ID_193
> https://emacs-fu.blogspot.com/2009/11/copying-lines-without-selecting-them.html
>
> So I think this command would be a good addition.  Making the word
> boundary behaviour into a tristate option sounds like a reasonable way
> forward, which should make everyone happy and let people experiment with
> what works best for them.

For reference purposes while implementing the tristate, here is my
implementation of the Unix behaviour from my init.
Should be helpful, though there is lots of room for improvement :)

(defun spw/unix-word-rubout (arg &optional pos neg)
  (interactive "p")
  ;; Do skip over \n because `backward-kill-word' does.
  (unless pos (setq pos "[:space:]\n"))
  (unless neg (setq neg "^[:space:]\n"))
  (undo-boundary)
  (let ((start (point)))
;; Go only backwards.
(dotimes (_ (abs arg))
  (skip-chars-backward pos)
  (skip-chars-backward neg))
;; Skip forward over any read-only text (e.g. an Eshell or comint 
prompt).
(when-let ((beg (and (get-char-property (point) 'read-only)
 (next-single-char-property-change
  (point) 'read-only nil start
  (goto-char beg))
(kill-region start (point

-- 
Sean Whitton





bug#72961: Possible documentation improvement: Clarification for package installation

2024-09-02 Thread Philip Kaludercic
Eli Zaretskii  writes:

>> From: Krystian Samp 
>> Date: Mon, 2 Sep 2024 12:41:11 +0200
>> 
>> I was reading the section on "Libraries of Lisp Code for Emacs" (section 
>> 28.8) in the Emacs manual, and I
>> encountered a passage that seems a bit unclear. The text suggests that when 
>> using package-install, Emacs
>> might automatically add initialization code to the init.el file, which 
>> doesn’t seem to match my experience.
>> 
>> Specifically, the manual states: "Installing a package using package-install 
>> takes care of placing the package’s
>> Lisp files in a directory where Emacs will find it, and also writes the 
>> necessary initialization code into your init
>> files [...]"
>> 
>> From my understanding, package-install does not modify init.el directly, 
>> which is how I interpret the
>> documentation above. Instead, Emacs calls package-initialize which makes the 
>> installed packages available,
>> automatically.
>> 
>> I want to check if this is a valid concern / interpretation that warrants a 
>> documentation change. If so, I'll be
>> happy to create a patch.
>
> Is package-quickstart.el considered "init file" or not?
>
> And I add Philip to this discussion, as he knows the package.el code
> better than I do.

I believe the documentation here is just outdated.  From NEWS.27:

  ** Installed packages are now activated *before* loading the init file.
  As a result of this change, it is no longer necessary to call
  'package-initialize' in your init file.

  Previously, a call to 'package-initialize' was automatically inserted
  into the init file when Emacs was started.  This call can now safely
  be removed.

Otherwise it might also refer to the fact that user option
`package-selected-packages' is saved, which by default will be stored in
the default Emacs configuration file. 

-- 
Philip Kaludercic on peregrine





bug#72986: Disabling menu-bar-mode changes size of new frames

2024-09-02 Thread Bug reports for GNU Emacs, the Swiss army knife of text editors
Reproduction with Emacs 29.3 (also with git master HEAD, see below).

Run: emacs -Q
C-x 5 2 ; window opens the same size as the initial window
M-x menu-bar-mode RET ; disable menu-bar-mode
C-x 52 ; window opens much smaller than initial window

With master HEAD (commit 92ea393a16e), the situation is slightly different:

Run: emacs -Q
C-x 52 ; window opens much smaller than initial window

When the new windows are opening at a small size, changing
default-frame-alist has no effect. When the new windows are opening at the
same size as the initial window (with Emacs 29.3, as above), then changing
default-frame-alist works as expected.

I'm running on Ubuntu 24.04, under GNOME 46 with X11. I don't have any
Emacs X resources set.

-- 
https://rrt.sc3d.org


bug#60321: 29.0.60; ruby-mode indentation of hash or array as first arg in multiline method call

2024-09-02 Thread Dmitry Gutov

On 02/09/2024 04:56, Aaron Jensen wrote:

It seems to me that anything other than 0 spaces would look inconsistent
with the first element (the hash), and its closing brace in particular.

Yeah, that's my sense as well, even if it looks awful, but you get what you get.


* Support for the new option in ruby-ts-mode (it's good to have parity).
Could you take the attached patch for a spin? Seems to work here, but
I'd like to have an extra confirmation.

I don't have the treesitter stuff installed at the moment, will try
this out shortly.

Thanks in advance.

I installed it and gave it a run on a few things. I didn't observe any
issues with it.


Great!

I've pushed both patches to emacs-30 (6c15b7710d4 and 24f12bdd77e) and 
now marking the issue as done. Thanks again for the patch.


To summarize for future readers: the default behavior doesn't change - 
at least not now - you need to customize the option for different 
indentation.






bug#60321: 29.0.60; ruby-mode indentation of hash or array as first arg in multiline method call

2024-09-02 Thread Aaron Jensen
 Thank you, and thanks for your help.


Aaron

On Mon, Sep 2 2024 at 3:01 PM, Dmitry Gutov  wrote:

> On 02/09/2024 04:56, Aaron Jensen wrote:
>
> It seems to me that anything other than 0 spaces would look inconsistent
> with the first element (the hash), and its closing brace in particular.
>
> Yeah, that's my sense as well, even if it looks awful, but you get what
> you get.
>
> * Support for the new option in ruby-ts-mode (it's good to have parity).
> Could you take the attached patch for a spin? Seems to work here, but I'd
> like to have an extra confirmation.
>
> I don't have the treesitter stuff installed at the moment, will try this
> out shortly.
>
> Thanks in advance.
>
> I installed it and gave it a run on a few things. I didn't observe any
> issues with it.
>
> Great!
>
> I've pushed both patches to emacs-30 (6c15b7710d4 and 24f12bdd77e) and now
> marking the issue as done. Thanks again for the patch.
>
> To summarize for future readers: the default behavior doesn't change - at
> least not now - you need to customize the option for different indentation.
>


bug#69097: [PATCH] Add 'kill-region-or-word' command

2024-09-02 Thread Philip Kaludercic


Stefan Kangas  writes:

> Eli Zaretskii  writes:
>
>>> From: Philip Kaludercic 
>>> Cc: Sean Whitton ,  j...@linkov.net,  
>>> r...@gnu.org,
>>>   69...@debbugs.gnu.org
>>> Date: Sun, 01 Sep 2024 20:06:00 +
>>>
>>> Ping.  I am not sure how to proceed on this patch.  IIRC the issue was
>>> that the notion of a word differs in Emacs and in Bash.  I am still in
>>> favour of utilising Emacs's definition, as it remains more useful
>>> for some given major mode and the fact that it is easier to implement.
>>
>> Or you could make the defcustom a tristate, and implement both
>> behaviors...
>>
>> As for how to proceed: Stefan and Andrea, do you have an opinion on
>> this?
>
> Binding C-w to backward-kill-word, or some version thereof, is an old
> Emacs power user trick that has been recommended in many places over the
> years.  See, for example:
> https://sites.google.com/site/steveyegge2/effective-emacs#h.p_ID_193
> https://emacs-fu.blogspot.com/2009/11/copying-lines-without-selecting-them.html
>
> So I think this command would be a good addition.  Making the word
> boundary behaviour into a tristate option sounds like a reasonable way
> forward, which should make everyone happy and let people experiment with
> what works best for them.

How about this suggestion:  We add a generic kill-region-or-word
command, and a user option for a function (set to either
`backward-kill-word' or Sean's `unix-word-rubout').  I can prepare a
patch with the simpler version, and then Sean can add his behaviour in a
second patch so that the attribution remains correct.

Sean Whitton  writes:

> Hello,
>
> On Mon 02 Sep 2024 at 11:30am -07, Stefan Kangas wrote:
>
>> Binding C-w to backward-kill-word, or some version thereof, is an old
>> Emacs power user trick that has been recommended in many places over the
>> years.  See, for example:
>> https://sites.google.com/site/steveyegge2/effective-emacs#h.p_ID_193
>> https://emacs-fu.blogspot.com/2009/11/copying-lines-without-selecting-them.html
>>
>> So I think this command would be a good addition.  Making the word
>> boundary behaviour into a tristate option sounds like a reasonable way
>> forward, which should make everyone happy and let people experiment with
>> what works best for them.
>
> For reference purposes while implementing the tristate, here is my
> implementation of the Unix behaviour from my init.
> Should be helpful, though there is lots of room for improvement :)
>
> (defun spw/unix-word-rubout (arg &optional pos neg)
>   (interactive "p")
>   ;; Do skip over \n because `backward-kill-word' does.
>   (unless pos (setq pos "[:space:]\n"))
>   (unless neg (setq neg "^[:space:]\n"))
>   (undo-boundary)
>   (let ((start (point)))
> ;; Go only backwards.
> (dotimes (_ (abs arg))
>   (skip-chars-backward pos)
>   (skip-chars-backward neg))
> ;; Skip forward over any read-only text (e.g. an Eshell or comint 
> prompt).
> (when-let ((beg (and (get-char-property (point) 'read-only)
>  (next-single-char-property-change
>   (point) 'read-only nil start
>   (goto-char beg))
> (kill-region start (point

FWIW I don't have any suggestions on how to improve the function either.

I wonder if it would make sense to have a minor mode like subword-mode
that would enforce a understanding of words like implemented here.

-- 
Philip Kaludercic on peregrine





bug#69097: [PATCH] Add 'kill-region-or-word' command

2024-09-02 Thread Sean Whitton
Hello,

On Mon 02 Sep 2024 at 08:39pm GMT, Philip Kaludercic wrote:

> How about this suggestion:  We add a generic kill-region-or-word
> command, and a user option for a function (set to either
> `backward-kill-word' or Sean's `unix-word-rubout').  I can prepare a
> patch with the simpler version, and then Sean can add his behaviour in a
> second patch so that the attribution remains correct.

I think a tristate option is preferable to this.

If the user wants something of their own they can just write their own
command.

-- 
Sean Whitton





bug#69097: [PATCH] Add 'kill-region-or-word' command

2024-09-02 Thread Philip Kaludercic
Sean Whitton  writes:

> Hello,
>
> On Mon 02 Sep 2024 at 08:39pm GMT, Philip Kaludercic wrote:
>
>> How about this suggestion:  We add a generic kill-region-or-word
>> command, and a user option for a function (set to either
>> `backward-kill-word' or Sean's `unix-word-rubout').  I can prepare a
>> patch with the simpler version, and then Sean can add his behaviour in a
>> second patch so that the attribution remains correct.
>
> I think a tristate option is preferable to this.

It would still be a user options with three states:

- nil (default, don't delete a word)
- #'backward-kill-word
- #'unix-word-rubout

> If the user wants something of their own they can just write their own
> command.

Sure, but going by that logic we don't need this change at all.

-- 
Philip Kaludercic on peregrine





bug#69097: [PATCH] Add 'kill-region-or-word' command

2024-09-02 Thread Sean Whitton
Hello,

On Mon 02 Sep 2024 at 09:42pm +01, Sean Whitton wrote:

> Hello,
>
> On Mon 02 Sep 2024 at 08:39pm GMT, Philip Kaludercic wrote:
>
>> How about this suggestion:  We add a generic kill-region-or-word
>> command, and a user option for a function (set to either
>> `backward-kill-word' or Sean's `unix-word-rubout').  I can prepare a
>> patch with the simpler version, and then Sean can add his behaviour in a
>> second patch so that the attribution remains correct.
>
> I think a tristate option is preferable to this.
>
> If the user wants something of their own they can just write their own
> command.

Sorry, I wrote this too quickly, I don't think I actually understand
your new proposal.

Could you sketch it out?

Thank you for your patience on this one.

-- 
Sean Whitton





bug#71374: [PATCH] Simplify 'help-enable-variable-value-editing' using

2024-09-02 Thread Philip Kaludercic
Philip Kaludercic  writes:

> Eshel Yaron  writes:
>
>> Philip Kaludercic  writes:
>>
>>> Eshel Yaron  writes:
>>>
 I'm reopening this (hope you don't mind) to keep track of the minor
 regressions I mentioned here:

 https://lists.gnu.org/archive/html/emacs-devel/2024-07/msg01202.html
>>>
>>> Thanks, and my apologies for the late reply.
>>
>> No problem at all.
>>
>>> The issue seems to be that (thing-at-point 'sexp) returns nil if inside
>>> a s-expression looking at whitespace:
>>>
>>> (1 2 3 4 5)
>>>  ^
>>>  M-: (thing-at-point 'sexp) ;=> nil
>>>
>>> One idea is to fall back on a defun at point, if no sexp is found:
>>>
>>> diff --git a/lisp/help-fns.el b/lisp/help-fns.el
>>> index 8ea5b301684..4d55ea8bbff 100644
>>> --- a/lisp/help-fns.el
>>> +++ b/lisp/help-fns.el
>>> @@ -1507,13 +1507,14 @@ help-fns-edit-variable
>>>"Edit the variable under point."
>>>(declare (completion ignore))
>>>(interactive)
>>> -  (let* ((val (thing-at-point 'sexp))
>>> - (var (get-text-property 0 'help-fns--edit-variable val)))
>>> +  (let ((val (or (thing-at-point 'sexp)
>>> + (thing-at-point 'defun
>>>  (unless val
>>> -  (error "No variable under point"))
>>> -(let ((str (read-string-from-buffer
>>> -(format ";; Edit the `%s' variable." (nth 0 var))
>>> -(prin1-to-string (nth 1 var)
>>> +  (error "No value at point"))
>>> +(let* ((var (get-text-property 0 'help-fns--edit-variable val))
>>> +   (str (read-string-from-buffer
>>> + (format ";; Edit the `%s' variable." (nth 0 var))
>>> + (prin1-to-string (nth 1 var)
>>>(set (nth 0 var) (read str)
>>
>> Maybe I'm missing something, but why are val and the thing-at-point call
>> needed at all?  Simply grabbing the help-fns--edit-variable property at
>> point should be work as well, I think.
>
> No, I think you are right, we don't have to take the detour over
> 'thing-at-point', meaning that if I am not mistaken, the fix should
> reduce itself to:
>
> diff --git a/lisp/help-fns.el b/lisp/help-fns.el
> index 8a2ae79736f..97d054ce6db 100644
> --- a/lisp/help-fns.el
> +++ b/lisp/help-fns.el
> @@ -1507,9 +1507,8 @@ help-fns-edit-variable
>"Edit the variable under point."
>(declare (completion ignore))
>(interactive)
> -  (let* ((val (thing-at-point 'sexp))
> - (var (get-text-property 0 'help-fns--edit-variable val)))
> -(unless val
> +  (let ((var (get-text-property (point) 'help-fns--edit-variable)))
> +(unless var
>(error "No variable under point"))
>  (let ((str (read-string-from-buffer
>  (format ";; Edit the `%s' variable." (nth 0 var))

I have pushed this change and am closing the report.

>> Eshel

-- 
Philip Kaludercic on peregrine





bug#69097: [PATCH] Add 'kill-region-or-word' command

2024-09-02 Thread Philip Kaludercic
Sean Whitton  writes:

> Hello,
>
> On Mon 02 Sep 2024 at 09:42pm +01, Sean Whitton wrote:
>
>> Hello,
>>
>> On Mon 02 Sep 2024 at 08:39pm GMT, Philip Kaludercic wrote:
>>
>>> How about this suggestion:  We add a generic kill-region-or-word
>>> command, and a user option for a function (set to either
>>> `backward-kill-word' or Sean's `unix-word-rubout').  I can prepare a
>>> patch with the simpler version, and then Sean can add his behaviour in a
>>> second patch so that the attribution remains correct.
>>
>> I think a tristate option is preferable to this.
>>
>> If the user wants something of their own they can just write their own
>> command.
>
> Sorry, I wrote this too quickly, I don't think I actually understand
> your new proposal.
>
> Could you sketch it out?
>
> Thank you for your patience on this one.

I had misremembered the last state of this patch.  It is easier to just
have a tristate option.  Here is the updated proposal:

diff --git a/lisp/simple.el b/lisp/simple.el
index eedc5768fe2..9ce108089e7 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5817,6 +5817,17 @@ kill-read-only-ok
   :type 'boolean
   :group 'killing)
 
+(defcustom kill-word-if-no-region nil
+  "Behaviour when `kill-region' is invoked without an active region.
+If set to nil (default), then an error occurs and nothing is killed.  If
+set to `emacs-word', then kill a the last word as defined by the current
+major mode.  If set to `unix-word', then kill the last word in the style
+of a shell like Bash, disregarding the major mode."
+  :type '(choice (const :tag "Kill a word like `backward-kill-word'" 
emacs-word)
+ (const :tag "Kill a word like Bash would" unix-word)
+ (const :tag "Do not kill anything" nil))
+  :group 'killing)
+
 (defun kill-region (beg end &optional region)
   "Kill (\"cut\") text between point and mark.
 This deletes the text from the buffer and saves it in the kill ring.
@@ -5839,25 +5850,47 @@ kill-region
 the text, but put the text in the kill ring anyway.  This means that
 you can use the killing commands to copy text from a read-only buffer.
 
-Lisp programs should use this function for killing text.
- (To delete text, use `delete-region'.)
-Supply two arguments, character positions BEG and END indicating the
- stretch of text to be killed.  If the optional argument REGION is
- non-nil, the function ignores BEG and END, and kills the current
- region instead.  Interactively, REGION is always non-nil, and so
- this command always kills the current region."
+Lisp programs should use this function for killing text.  (To delete
+text, use `delete-region'.)  Supply two arguments, character positions
+BEG and END indicating the stretch of text to be killed.  If the
+optional argument REGION is non-nil, the function ignores BEG and END,
+and kills the current region instead.  If REGION has the special value
+`kill-word', then it will kill the previous word, as with
+`backward-kill-word'.  Interactively, REGION is always non-nil, and so
+this command always kills the current region."
   ;; Pass mark first, then point, because the order matters when
   ;; calling `kill-append'.
   (interactive (progn
  (let ((beg (mark))
(end (point)))
-   (unless (and beg end)
- (user-error "The mark is not set now, so there is no 
region"))
-   (list beg end 'region
+   (cond
+((and beg end (use-region-p))
+ (list beg end 'region))
+(kill-word-if-no-region
+ (list beg end kill-word-if-no-region))
+((user-error "The mark is not set now, so there is no 
region"))
+
   (condition-case nil
-  (let ((string (if region
-(funcall region-extract-function 'delete)
-  (filter-buffer-substring beg end 'delete
+  (let ((string (cond
+ ((eq region 'emacs-word)
+  (let ((end (point)))
+(save-excursion
+  (forward-word -1)
+  (filter-buffer-substring (point) end 'delete
+ ((eq region 'unix-word)
+  (let ((end (point)))
+(save-excursion
+  (skip-chars-backward "[:space:]")
+  (skip-chars-backward "^[:space:]")
+  (filter-buffer-substring
+   (if (get-char-property (point) 'read-only)
+   (next-single-char-property-change
+(point) 'read-only nil end)
+ (point))
+   end 'delete
+ (region
+  (funcall region-extract-function 'delete))
+ ((filter-buffer-substring beg end 'delete)
(when st

bug#72993: 31.0.50; 4f521fa14c18f57e5207bffd68e9f79454dccc79 breaks binding mode hooks in use-package

2024-09-02 Thread Bug reports for GNU Emacs, the Swiss army knife of text editors



In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, cairo version
 1.18.0) of 2024-09-01 built on Laptop
Repository revision: 92ea393a16e5c99a8860dab368c6ca3ca6abc3c5
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: Arch Linux

To reproduce:

(use-package foo
:hook (eshell-mode . some-function))

Previously, `use-package' always appended `-hook' to the hook variable name.
After 4f521fa14c18f57e5207bffd68e9f79454dccc79, `use-package' only does
so if the passed variable name isn't bound. Unfortunately, this breaks
binding mode hooks, e.g.:

:hook (some-mode . some-function)

Because `some-mode' is usually bound.

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-modules --without-m17n-flt --without-selinux --without-pop
 --without-gconf --enable-link-time-optimization
 --with-native-compilation=yes --with-xinput2 --with-x-toolkit=no
 --without-toolkit-scroll-bars --without-xft --without-xaw3d
 --without-gsettings --with-cairo-xcb --with-sound=no --with-tree-sitter
 --without-gpm --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=native -mtune=native -O3 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -flto=auto' 'LDFLAGS=-Wl,-O1
 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now
 -Wl,-z,pack-relative-relocs -flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LCMS2 LIBOTF
LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY OLDXMENU PDUMPER
PNG RSVG SECCOMP SQLITE3 THREADS TIFF TREE_SITTER WEBP X11 XDBE XIM
XINPUT2 XPM ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Eshell

Minor modes in effect:
  eshell-syntax-highlighting-mode: t
  notmuch-bookmarks-mode: t
  windmove-mode: t
  global-atomic-chrome-edit-mode: t
  i3bar-mode: t
  ednc-mode: t
  exwm-xsettings-mode: t
  exwm-background-mode: t
  exwm-systemtray-mode: t
  exwm-randr-mode: t
  auto-compile-on-load-mode: t
  auto-compile-on-save-mode: t
  save-place-mode: t
  savehist-mode: t
  openwith-mode: t
  org-super-agenda-mode: t
  global-org-modern-mode: t
  goto-address-mode: t
  eshell-prompt-mode: t
  eshell-hist-mode: t
  eshell-pred-mode: t
  eat-eshell-mode: t
  eat--eshell-local-mode: t
  eshell-proc-mode: t
  eshell-arg-mode: t
  magit-todos-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  server-mode: t
  recentf-mode: t
  global-treesit-auto-mode: t
  editorconfig-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  async-bytecomp-package-mode: t
  sudo-edit-indicator-mode: t
  global-auto-revert-mode: t
  vertico-mode: t
  corfu-popupinfo-mode: t
  global-corfu-mode: t
  corfu-mode: t
  isearch-mb-mode: t
  pixel-scroll-precision-mode: t
  global-hl-todo-mode: t
  all-the-icons-completion-mode: t
  marginalia-mode: t
  global-form-feed-st-mode: t
  global-anzu-mode: t
  anzu-mode: t
  global-jinx-mode: t
  evil-goggles-mode: t
  global-evil-surround-mode: t
  evil-surround-mode: t
  global-evil-collection-unimpaired-mode: t
  evil-collection-unimpaired-mode: t
  evil-mode: t
  evil-local-mode: t
  desktop-environment-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-history-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  window-divider-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/steb/.cache/emacs/elpa/protobuf-mode-20240823.1417/protobuf-mode hides 
/usr/share/emacs/site-lisp/protobuf-mode
/home/steb/.cache/emacs/elpa/notmuch-20240816.2039/notmuch hides 
/usr/share/emacs/site-lisp/notmuch
/home/steb/.cache/emacs/elpa/notmuch-20240816.2039/notmuch-wash hides 
/usr/share/emacs/site-lisp/notmuch-wash
/home/steb/.cache/emacs/elpa/notmuch-20240816.2039/notmuch-tree hides 
/usr/share/emacs/site-lisp/notmuch-tree
/home/steb/.cache/emacs/elpa/notmuch-20240816.2039/notmuch-tag hides 
/usr/share/emacs/site-lisp/notmuch-tag
/home/steb/.cache/emacs/elpa/notmuch-20240816.2039/notmuch-show hides 
/usr/share/emacs/site-lisp/notmuch-show
/home/steb/.cache/emacs/elpa/notmuch-20240816.2039/notmuch-query hides 
/usr/share/emacs/site-lisp/notmuch-query
/home/steb/.cache/emacs/elpa/notmuch-20240816.2039/notmuch-print hides 
/usr/share/emacs/site-lisp/notmuch-print
/home/steb/.cache/emacs/elpa/notmuch-20240816.2039/notmuch-parser hides 
/usr/share/emacs/site-lisp/notmuch-parser
/home/steb/.cache/emacs/elpa/notmuch-20240816.2039/notmuch-mua hides 
/usr/share/emacs/site-lisp/notmuch-mua
/home/steb/.cache/emacs/elpa/notmuch-20240816.2039/notmuch-mes

bug#72993: 31.0.50; 4f521fa14c18f57e5207bffd68e9f79454dccc79 breaks binding mode hooks in use-package

2024-09-02 Thread Eli Zaretskii
> Date: Mon, 02 Sep 2024 19:01:31 -0700
> From:  Steven Allen via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" 
> 
> 
> 
> In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, cairo version
>  1.18.0) of 2024-09-01 built on Laptop
> Repository revision: 92ea393a16e5c99a8860dab368c6ca3ca6abc3c5
> Repository branch: master
> Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
> System Description: Arch Linux
> 
> To reproduce:
> 
> (use-package foo
> :hook (eshell-mode . some-function))
> 
> Previously, `use-package' always appended `-hook' to the hook variable name.
> After 4f521fa14c18f57e5207bffd68e9f79454dccc79, `use-package' only does
> so if the passed variable name isn't bound. Unfortunately, this breaks
> binding mode hooks, e.g.:
> 
> :hook (some-mode . some-function)
> 
> Because `some-mode' is usually bound.

John, any comments or suggestions?





bug#72995: 31.0.50; widget-move fails when widget starts at the second character in the buffer

2024-09-02 Thread Dale
I think changes in commit 94dec95 (bug#69943) broke `widget-move' in a 
customize buffer when trying to move to the first widget in a buffer when that 
first widget starts at the second character in the buffer.  Here's some code to 
reproduce (tested in IELM):

(let* ((first-wid (progn (widget-forward 1) (point
  (print (format "First widget at %S" first-wid))
  (cl-assert (and (numberp first-wid) (>= first-wid 1)))
  (with-current-buffer (customize-group 'editing)
(narrow-to-region (1- first-wid) (point-max))
(goto-char (point-min))
(widget-forward 1)
(print (format "Expected to be at %S, point=%S" first-wid (point)

On my Emacs I get:

"First widget at 33"

"Expected to be at 33, point=32"

I think this happens because of this code near the end of `widget-move' (which 
is called by `widget-forward'):

(let ((new (widget-tabable-at)))
  (while (and (eq (widget-tabable-at) new) (not (bobp)))
(backward-char)))
(unless (bobp) (forward-char)))

In my test case, as we enter the while loop point is at the start of the first 
widget (AKA "new").  We are not yet at beginning of buffer, so it moves point 
back one character.  Now we are at beginning of buffer, but that doesn't 
matter: the `eq' test fails first, and the loop ends.

However, the `forward-char' never runs because we are indeed at beginning of 
buffer now.  I think this `forward-char' should have been run to put point back 
on the start of the widget.

Bug#70594 also recently modified code around here, but I don't *think* that's 
relevant.

In case you're wondering, this comes up because I use link-hint[1], which 
narrows a customize buffer in exactly the way shown above.

[1]: https://github.com/noctuid/link-hint.el

Please let me know if I can provide any more information!

Best regards,
Dale


In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin23.6.0, NS
appkit-2487.70 Version 14.6.1 (Build 23G93)) of 2024-09-01 built on
mymacRepository revision: 0f98515cec1298bc82c589b5f8565503900b806d
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.6.1

Configured using:
 'configure --without-x --with-xwidgets --with-json --with-tree-sitter 
--without-imagemagick --with-xpm --with-jpeg --with-tiff --with-gif --with-png 
--with-rsvg --with-webp --with-sqlite3 --with-cairo --with-xml2 --with-gnutls 
--with-zlib --with-modules --with-threads --with-native-compilation --with-ns 
--enable-ns-self-contained 'CFLAGS= -D_DARWIN_UNLIMITED_SELECT=1 
-DFD_SETSIZE=10240''






bug#72993: 31.0.50; 4f521fa14c18f57e5207bffd68e9f79454dccc79 breaks binding mode hooks in use-package

2024-09-02 Thread John Wiegley
> Eli Zaretskii  writes:

>> To reproduce:
>> 
>> (use-package foo
>> :hook (eshell-mode . some-function))
>> 
>> Previously, `use-package' always appended `-hook' to the hook variable name.
>> After 4f521fa14c18f57e5207bffd68e9f79454dccc79, `use-package' only does
>> so if the passed variable name isn't bound. Unfortunately, this breaks
>> binding mode hooks, e.g.:
>> 
>> :hook (some-mode . some-function)
>> 
>> Because `some-mode' is usually bound.

> John, any comments or suggestions?

Sigh, I should have thought of this. There will be many such collisions, in
fact.

Perhaps we should avoid auto -hook’ifying the variable name only if the name
does not already end in ‘-functions’?

What do you think, Eli?

-- 
John Wiegley  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com  60E1 46C4 BD1A 7AC1 4BA2