unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* bug#60346: VC refresh error "Recursive load"
@ 2022-12-26 21:26  4% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-12-27 14:05  0% ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-26 21:26 UTC (permalink / raw)
  To: 60346

Hello,

I wanted to ignore byte-compiled files because edebug was refusing to
step into byte-compiled functions.

I ran the following:

emacs -Q --eval="(setq load-suffixes '(\".el\"))"

This broke basic functionality, throwing a "Recursive load" error. For
example, `M-x find-file ~/.emacs.d/init.el` gives:

VC refresh error: (error "Recursive load" "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz" "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz" "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz" "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz" "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz" "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/vc/vc-git.el.gz")
load-with-code-conversion: Recursive load: "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz", "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz", "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz", "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz", "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz", "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/vc/vc-git.el.gz"

Emacs also breaks when load-suffixes are reordered:

emacs -Q --eval="(setq load-suffixes '(\".el\" \".so\" \".elc\"))"

I am running Guix on a foreign distro Debian Bullseye. Shall I send this
issue to the Guix mailing list instead?

Thank you!

Joseph





^ permalink raw reply	[relevance 4%]

* bug#60346: VC refresh error "Recursive load"
  2022-12-26 21:26  4% bug#60346: VC refresh error "Recursive load" Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-27 14:05  0% ` Eli Zaretskii
  0 siblings, 0 replies; 200+ results
From: Eli Zaretskii @ 2022-12-27 14:05 UTC (permalink / raw)
  To: Joseph Turner, Stefan Monnier; +Cc: 60346

> Date: Mon, 26 Dec 2022 13:26:17 -0800
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> I wanted to ignore byte-compiled files because edebug was refusing to
> step into byte-compiled functions.
> 
> I ran the following:
> 
> emacs -Q --eval="(setq load-suffixes '(\".el\"))"
> 
> This broke basic functionality, throwing a "Recursive load" error. For
> example, `M-x find-file ~/.emacs.d/init.el` gives:
> 
> VC refresh error: (error "Recursive load" "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz" "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz" "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz" "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz" "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz" "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/vc/vc-git.el.gz")
> load-with-code-conversion: Recursive load: "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz", "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz", "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz", "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz", "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/jka-compr.el.gz", "/gnu/store/x8nykb09aqmp2j6k74dpgc4jvbk8c2bl-emacs-next-29.0.50-3.22e8a77/share/emacs/29.0.50/lisp/vc/vc-git.el.gz"
> 
> Emacs also breaks when load-suffixes are reordered:
> 
> emacs -Q --eval="(setq load-suffixes '(\".el\" \".so\" \".elc\"))"
> 
> I am running Guix on a foreign distro Debian Bullseye. Shall I send this
> issue to the Guix mailing list instead?

I'm not sure we want to support this kind of changes in the order or
contents of load-suffixes.  It sounds to me like the order is there
for as reason, and no part of Emacs expects these lists to be
reordered, let alone have some extensions removed from them.  I think
the only valid changes are adding extensions to the end.

Stefan, WDYT?





^ permalink raw reply	[relevance 0%]

* bug#60643: 29.0.50; set-buffer-major-mode resets buffer local variables
@ 2023-01-08  4:48  5% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-01-08  5:45  5% ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-01-08  6:00  0% ` Eli Zaretskii
  0 siblings, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-08  4:48 UTC (permalink / raw)
  To: 60643

Hello!

It appears that set-buffer-major-mode resets buffer local variables.

To reproduce with `emacs -Q`:

(defvar-local test-var nil)
(setq test-var t)
(message "%s" test-var) ;; t
;; (set-auto-mode)
(set-buffer-major-mode (current-buffer))
(message "%s" test-var) ;; nil

Is this behavior expected?

Thank you!!

Joseph

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.30, cairo version 1.16.0)
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash
 SHELL=/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash
 --prefix=/gnu/store/4mnib031vflf88ms8w7kyfahcbv1k9vc-emacs-next-29.0.50-3.22e8a77
 --enable-fast-install --with-modules --with-cairo
 --with-native-compilation --disable-build-details'

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 X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB





^ permalink raw reply	[relevance 5%]

* bug#60643: 29.0.50; set-buffer-major-mode resets buffer local variables
  2023-01-08  4:48  5% bug#60643: 29.0.50; set-buffer-major-mode resets buffer local variables Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-01-08  5:45  5% ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-01-08  6:00  0% ` Eli Zaretskii
  1 sibling, 0 replies; 200+ results
From: Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-08  5:45 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 60643


Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> writes:

> Hello!
>
> It appears that set-buffer-major-mode resets buffer local variables.
>
> To reproduce with `emacs -Q`:
>
> (defvar-local test-var nil)
> (setq test-var t)
> (message "%s" test-var) ;; t
> ;; (set-auto-mode)
> (set-buffer-major-mode (current-buffer))
> (message "%s" test-var) ;; nil
>
> Is this behavior expected?
>
> Thank you!!
>
> Joseph
>
> In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
> 3.24.30, cairo version 1.16.0)
> Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
> System Description: Debian GNU/Linux 11 (bullseye)
>
> Configured using:
>  'configure
>  CONFIG_SHELL=/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash
>  SHELL=/gnu/store/4y5m9lb8k3qkb1y9m02sw9w9a6hacd16-bash-minimal-5.1.8/bin/bash
>  --prefix=/gnu/store/4mnib031vflf88ms8w7kyfahcbv1k9vc-emacs-next-29.0.50-3.22e8a77
>  --enable-fast-install --with-modules --with-cairo
>  --with-native-compilation --disable-build-details'
>
> 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 X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

There is another concept called "permanent local variables" which you
might be thinking about when looking at "local variables", see info node
`(elisp) Standard Properties' for more information.

Best,


RY





^ permalink raw reply	[relevance 5%]

* bug#60643: 29.0.50; set-buffer-major-mode resets buffer local variables
  2023-01-08  4:48  5% bug#60643: 29.0.50; set-buffer-major-mode resets buffer local variables Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-01-08  5:45  5% ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-01-08  6:00  0% ` Eli Zaretskii
  2023-01-08  9:09  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-01-08  9:09  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 2 replies; 200+ results
From: Eli Zaretskii @ 2023-01-08  6:00 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 60643

> Date: Sat, 07 Jan 2023 20:48:54 -0800
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> It appears that set-buffer-major-mode resets buffer local variables.
> 
> To reproduce with `emacs -Q`:
> 
> (defvar-local test-var nil)
> (setq test-var t)
> (message "%s" test-var) ;; t
> ;; (set-auto-mode)
> (set-buffer-major-mode (current-buffer))
> (message "%s" test-var) ;; nil
> 
> Is this behavior expected?

Yes, I think so.  Changing the major mode kills all buffer-local
variables.  If you don't want some variable to be killed, give it the
permanent-local property.





^ permalink raw reply	[relevance 0%]

* bug#60643: 29.0.50; set-buffer-major-mode resets buffer local variables
  2023-01-08  6:00  0% ` Eli Zaretskii
@ 2023-01-08  9:09  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-01-08  9:09  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-08  9:09 UTC (permalink / raw)
  To: Eli Zaretskii, ruijie; +Cc: 60643

Hello!

Eli Zaretskii <eliz@gnu.org> writes:

> Changing the major mode kills all buffer-local variables. If you don't
> want some variable to be killed, give it the permanent-local property.

Ruijie Yu <ruijie@netyu.xyz> writes:

> There is another concept called "permanent local variables" which you
> might be thinking about when looking at "local variables", see info node
> `(elisp) Standard Properties' for more information.

Thank you both for your help!! This solves it:

(put 'test-var 'permanent-local t)

Joseph





^ permalink raw reply	[relevance 5%]

* bug#60643: 29.0.50; set-buffer-major-mode resets buffer local variables
  2023-01-08  6:00  0% ` Eli Zaretskii
  2023-01-08  9:09  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-01-08  9:09  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-08  9:09 UTC (permalink / raw)
  To: Eli Zaretskii, ruijie; +Cc: 60643-done

Hello!

Eli Zaretskii <eliz@gnu.org> writes:

> Changing the major mode kills all buffer-local variables. If you don't
> want some variable to be killed, give it the permanent-local property.

Ruijie Yu <ruijie@netyu.xyz> writes:

> There is another concept called "permanent local variables" which you
> might be thinking about when looking at "local variables", see info node
> `(elisp) Standard Properties' for more information.

Thank you both for your help!! This solves it:

(put 'test-var 'permanent-local t)

Joseph





^ permalink raw reply	[relevance 5%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
@ 2023-05-06 20:39  9% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-07  9:03  5% ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-06 20:39 UTC (permalink / raw)
  To: 63336; +Cc: Philip Kaludercic

[-- Attachment #1: Type: text/plain, Size: 167 bytes --]

Hello!

Here's a patch to support :make and :shell-command args as discussed:

https://lists.gnu.org/archive/html/help-gnu-emacs/2023-04/msg00263.html

Best,

Joseph


[-- Attachment #2: 0001-package-vc-Process-make-and-shell-command-spec-args.patch --]
[-- Type: text/x-diff, Size: 2582 bytes --]

From c51161c51f11e6ffcba17758424596fe44f9d42a Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 6 May 2023 13:44:32 -0700
Subject: [PATCH] package-vc: Process :make and :shell-command spec args

---
 lisp/emacs-lisp/package-vc.el | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 421947b528d..489610e2a1e 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -344,6 +344,35 @@ asynchronously."
         "\n")
        nil pkg-file nil 'silent))))
 
+(defcustom package-vc-process-make nil
+  "If non-nil, process :make and :shell-command spec arguments.
+Package specs are loaded from trusted package archives."
+  :type 'boolean)
+
+(defun package-vc--call (destination program &rest args)
+  "Like ‘call-process’ for PROGRAM, DESTINATION, ARGS.
+The INFILE and DISPLAY arguments are fixed as nil."
+  (apply #'call-process program nil destination nil (delq nil args)))
+
+(defun package-vc--make (pkg-spec dir)
+  "Process :make and :shell-command spec arguments."
+  (let ((target (plist-get pkg-spec :make))
+        (cmd (plist-get pkg-spec :shell-command)))
+    (when (or cmd target)
+      (with-current-buffer (get-buffer-create " *package-vc make*")
+        (erase-buffer)
+        (when (and cmd
+                   (/= 0 (package-vc--call t shell-file-name
+                                           shell-command-switch
+                                           cmd)))
+          (message "Failed to run %s, see buffer %S"
+                   cmd (buffer-name)))
+        (when (and target
+                   (/= 0 (apply #'package-vc--call t "make"
+                                (if (consp target) target (list target)))))
+          (message "Failed to make %s, see buffer %S"
+                   target (buffer-name)))))))
+
 (declare-function org-export-to-file "ox" (backend file))
 
 (defun package-vc--build-documentation (pkg-desc file)
@@ -486,6 +515,9 @@ documentation and marking the package as installed."
       ;; Generate package file
       (package-vc--generate-description-file pkg-desc pkg-file)
 
+      ;; Process :make and :shell-command arguments before building documentation
+      (when package-vc-process-make (package-vc--make pkg-spec pkg-dir))
+
       ;; Detect a manual
       (when (executable-find "install-info")
         (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
-- 
2.39.2


^ permalink raw reply related	[relevance 9%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
@ 2023-05-06 20:54 10% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-07  9:58  5% ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-06 20:54 UTC (permalink / raw)
  To: 63337; +Cc: Philip Kaludercic

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

Hello!

Because package-vc--build-documentation exports the texinfo manual to a
temp file inside /tmp/ , any @include statements with relative paths
break the makeinfo call.

I noticed this issue when attempting to use package-vc to install
org-transclusion, whose manual contains the line

#+texinfo: @include fdl.texi

See: https://raw.githubusercontent.com/nobiot/org-transclusion/main/docs/org-transclusion-manual.org

The attached patch solves this problem by passing the -I flag to
makeinfo. From makeinfo --help:

-I DIR                        append DIR to the @include search path.

Best,

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-package-vc-build-documentation-Relative-include-.patch --]
[-- Type: text/x-diff, Size: 1478 bytes --]

From a41abce88ed3b833c5531208945474c9cd16284b Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 6 May 2023 14:49:43 -0700
Subject: [PATCH] Fix: (package-vc--build-documentation) Relative @include
 statements

---
 lisp/emacs-lisp/package-vc.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 489610e2a1e..63c10285ca7 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -381,6 +381,7 @@ FILE can be an Org file, indicated by its \".org\" extension,
 otherwise it's assumed to be an Info file."
   (let* ((pkg-name (package-desc-name pkg-desc))
          (default-directory (package-desc-dir pkg-desc))
+         (docs-directory (expand-file-name (file-name-directory file)))
          (output (expand-file-name (format "%s.info" pkg-name)))
          clean-up)
     (when (string-match-p "\\.org\\'" file)
@@ -395,7 +396,9 @@ otherwise it's assumed to be an Info file."
       (erase-buffer)
       (cond
        ((/= 0 (call-process "makeinfo" nil t nil
-                            "--no-split" file "-o" output))
+                            "-I" docs-directory
+                            "--no-split" file
+                            "-o" output))
         (message "Failed to build manual %s, see buffer %S"
                  file (buffer-name)))
        ((/= 0 (call-process "install-info" nil t nil
-- 
2.39.2


^ permalink raw reply related	[relevance 10%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-06 20:39  9% bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-07  9:03  5% ` Philip Kaludercic
  2023-05-07 18:47  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-05-07  9:03 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63336

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Hello!
>
> Here's a patch to support :make and :shell-command args as discussed:
>
> https://lists.gnu.org/archive/html/help-gnu-emacs/2023-04/msg00263.html

Thanks!

> Best,
>
> Joseph
>
> From c51161c51f11e6ffcba17758424596fe44f9d42a Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Sat, 6 May 2023 13:44:32 -0700
> Subject: [PATCH] package-vc: Process :make and :shell-command spec args
>
> ---
>  lisp/emacs-lisp/package-vc.el | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index 421947b528d..489610e2a1e 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -344,6 +344,35 @@ asynchronously."
>          "\n")
>         nil pkg-file nil 'silent))))
>  
> +(defcustom package-vc-process-make nil
> +  "If non-nil, process :make and :shell-command spec arguments.
> +Package specs are loaded from trusted package archives."
> +  :type 'boolean)

As this patch is going to be added to Emacs 30, we should add

  :version "30.1"

tags to this user option.

> +(defun package-vc--call (destination program &rest args)
> +  "Like ‘call-process’ for PROGRAM, DESTINATION, ARGS.
           ^
You should replace these quotation marks with regular ASCII `marks', so
avoid byte-compiler warnings.

> +The INFILE and DISPLAY arguments are fixed as nil."
> +  (apply #'call-process program nil destination nil (delq nil args)))

What is the motivation for this function?  Is this where
process-isolation would be added in the future?

> +(defun package-vc--make (pkg-spec dir)
> +  "Process :make and :shell-command spec arguments."
> +  (let ((target (plist-get pkg-spec :make))
> +        (cmd (plist-get pkg-spec :shell-command)))
> +    (when (or cmd target)
> +      (with-current-buffer (get-buffer-create " *package-vc make*")
                                                 ^
                                                 should the package name
                                                 be mentioned here?
> +        (erase-buffer)
> +        (when (and cmd
> +                   (/= 0 (package-vc--call t shell-file-name
> +                                           shell-command-switch
> +                                           cmd)))
> +          (message "Failed to run %s, see buffer %S"

Could `warn' be a better candidate here, instead of `message'?

> +                   cmd (buffer-name)))
> +        (when (and target
> +                   (/= 0 (apply #'package-vc--call t "make"
> +                                (if (consp target) target (list target)))))
> +          (message "Failed to make %s, see buffer %S"
> +                   target (buffer-name)))))))
> +
>  (declare-function org-export-to-file "ox" (backend file))
>  
>  (defun package-vc--build-documentation (pkg-desc file)
> @@ -486,6 +515,9 @@ documentation and marking the package as installed."
>        ;; Generate package file
>        (package-vc--generate-description-file pkg-desc pkg-file)
>  
> +      ;; Process :make and :shell-command arguments before building documentation
> +      (when package-vc-process-make (package-vc--make pkg-spec pkg-dir))

Wasn't the plan to allow `package-vc-process-make' to either be a
generic "build-anything" or a selective listing of packages where we
allow :make and :shell-command to be executed?

> +
>        ;; Detect a manual
>        (when (executable-find "install-info")
>          (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))

Otherwise this looks good, but I haven't tried it out yet.

-- 
Philip Kaludercic





^ permalink raw reply	[relevance 5%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-06 20:54 10% bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-07  9:58  5% ` Philip Kaludercic
  2023-05-07 10:56  0%   ` Eli Zaretskii
  2023-05-07 18:40 10%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 200+ results
From: Philip Kaludercic @ 2023-05-07  9:58 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63337

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Hello!
>
> Because package-vc--build-documentation exports the texinfo manual to a
> temp file inside /tmp/ , any @include statements with relative paths
> break the makeinfo call.
>
> I noticed this issue when attempting to use package-vc to install
> org-transclusion, whose manual contains the line
>
> #+texinfo: @include fdl.texi
>
> See: https://raw.githubusercontent.com/nobiot/org-transclusion/main/docs/org-transclusion-manual.org
>
> The attached patch solves this problem by passing the -I flag to
> makeinfo. From makeinfo --help:
>
> -I DIR                        append DIR to the @include search path.

Good catch, this should be applied to emacs-29.

> Best,
>
> Joseph
>
> From a41abce88ed3b833c5531208945474c9cd16284b Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Sat, 6 May 2023 14:49:43 -0700
> Subject: [PATCH] Fix: (package-vc--build-documentation) Relative @include
>  statements
>
> ---
>  lisp/emacs-lisp/package-vc.el | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index 489610e2a1e..63c10285ca7 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -381,6 +381,7 @@ FILE can be an Org file, indicated by its \".org\" extension,
>  otherwise it's assumed to be an Info file."
>    (let* ((pkg-name (package-desc-name pkg-desc))
>           (default-directory (package-desc-dir pkg-desc))
> +         (docs-directory (expand-file-name (file-name-directory file)))
>           (output (expand-file-name (format "%s.info" pkg-name)))
>           clean-up)
>      (when (string-match-p "\\.org\\'" file)
> @@ -395,7 +396,9 @@ otherwise it's assumed to be an Info file."
>        (erase-buffer)
>        (cond
>         ((/= 0 (call-process "makeinfo" nil t nil
> -                            "--no-split" file "-o" output))
> +                            "-I" docs-directory

According to the docs, makeinfo has -I to append the search path, and -P
to prepend.  I don't know how well either of the two are supported, but
assuming they are, shouldn't -P be preferred?  Or wouldn't it have any
effect?

> +                            "--no-split" file
> +                            "-o" output))
>          (message "Failed to build manual %s, see buffer %S"
>                   file (buffer-name)))
>         ((/= 0 (call-process "install-info" nil t nil

-- 
Philip Kaludercic





^ permalink raw reply	[relevance 5%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-07  9:58  5% ` Philip Kaludercic
@ 2023-05-07 10:56  0%   ` Eli Zaretskii
  2023-05-07 18:40 10%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-05-07 10:56 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63337, joseph

> Cc: 63337@debbugs.gnu.org
> From: Philip Kaludercic <philipk@posteo.net>
> Date: Sun, 07 May 2023 09:58:19 +0000
> 
> Joseph Turner <joseph@breatheoutbreathe.in> writes:
> 
> > Hello!
> >
> > Because package-vc--build-documentation exports the texinfo manual to a
> > temp file inside /tmp/ , any @include statements with relative paths
> > break the makeinfo call.
> >
> > I noticed this issue when attempting to use package-vc to install
> > org-transclusion, whose manual contains the line
> >
> > #+texinfo: @include fdl.texi
> >
> > See: https://raw.githubusercontent.com/nobiot/org-transclusion/main/docs/org-transclusion-manual.org
> >
> > The attached patch solves this problem by passing the -I flag to
> > makeinfo. From makeinfo --help:
> >
> > -I DIR                        append DIR to the @include search path.
> 
> Good catch, this should be applied to emacs-29.

Fine by me.





^ permalink raw reply	[relevance 0%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-07  9:58  5% ` Philip Kaludercic
  2023-05-07 10:56  0%   ` Eli Zaretskii
@ 2023-05-07 18:40 10%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-07 19:11  0%     ` Eli Zaretskii
  2023-05-13  8:41  5%     ` Philip Kaludercic
  1 sibling, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-07 18:40 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63337

[-- Attachment #1: Type: text/plain, Size: 2811 bytes --]


Philip Kaludercic <philipk@posteo.net> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Hello!
>>
>> Because package-vc--build-documentation exports the texinfo manual to a
>> temp file inside /tmp/ , any @include statements with relative paths
>> break the makeinfo call.
>>
>> I noticed this issue when attempting to use package-vc to install
>> org-transclusion, whose manual contains the line
>>
>> #+texinfo: @include fdl.texi
>>
>> See: https://raw.githubusercontent.com/nobiot/org-transclusion/main/docs/org-transclusion-manual.org
>>
>> The attached patch solves this problem by passing the -I flag to
>> makeinfo. From makeinfo --help:
>>
>> -I DIR                        append DIR to the @include search path.
>
> Good catch, this should be applied to emacs-29.
>
>> Best,
>>
>> Joseph
>>
>> From a41abce88ed3b833c5531208945474c9cd16284b Mon Sep 17 00:00:00 2001
>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Date: Sat, 6 May 2023 14:49:43 -0700
>> Subject: [PATCH] Fix: (package-vc--build-documentation) Relative @include
>>  statements
>>
>> ---
>>  lisp/emacs-lisp/package-vc.el | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>> index 489610e2a1e..63c10285ca7 100644
>> --- a/lisp/emacs-lisp/package-vc.el
>> +++ b/lisp/emacs-lisp/package-vc.el
>> @@ -381,6 +381,7 @@ FILE can be an Org file, indicated by its \".org\" extension,
>>  otherwise it's assumed to be an Info file."
>>    (let* ((pkg-name (package-desc-name pkg-desc))
>>           (default-directory (package-desc-dir pkg-desc))
>> +         (docs-directory (expand-file-name (file-name-directory file)))
>>           (output (expand-file-name (format "%s.info" pkg-name)))
>>           clean-up)
>>      (when (string-match-p "\\.org\\'" file)
>> @@ -395,7 +396,9 @@ otherwise it's assumed to be an Info file."
>>        (erase-buffer)
>>        (cond
>>         ((/= 0 (call-process "makeinfo" nil t nil
>> -                            "--no-split" file "-o" output))
>> +                            "-I" docs-directory
>
> According to the docs, makeinfo has -I to append the search path, and -P
> to prepend.  I don't know how well either of the two are supported, but
> assuming they are, shouldn't -P be preferred?  Or wouldn't it have any
> effect?

I am not sure what difference it would make. I don't know if the default
@include search path includes anything besides the working directory.

In the attached diff, I have changed -I to -P.

>> +                            "--no-split" file
>> +                            "-o" output))
>>          (message "Failed to build manual %s, see buffer %S"
>>                   file (buffer-name)))
>>         ((/= 0 (call-process "install-info" nil t nil


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-package-vc-build-documentation-Relative-include-.patch --]
[-- Type: text/x-diff, Size: 1478 bytes --]

From a41abce88ed3b833c5531208945474c9cd16284b Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 6 May 2023 14:49:43 -0700
Subject: [PATCH] Fix: (package-vc--build-documentation) Relative @include
 statements

---
 lisp/emacs-lisp/package-vc.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 489610e2a1e..63c10285ca7 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -381,6 +381,7 @@ FILE can be an Org file, indicated by its \".org\" extension,
 otherwise it's assumed to be an Info file."
   (let* ((pkg-name (package-desc-name pkg-desc))
          (default-directory (package-desc-dir pkg-desc))
+         (docs-directory (expand-file-name (file-name-directory file)))
          (output (expand-file-name (format "%s.info" pkg-name)))
          clean-up)
     (when (string-match-p "\\.org\\'" file)
@@ -395,7 +396,9 @@ otherwise it's assumed to be an Info file."
       (erase-buffer)
       (cond
        ((/= 0 (call-process "makeinfo" nil t nil
-                            "--no-split" file "-o" output))
+                            "-P" docs-directory
+                            "--no-split" file
+                            "-o" output))
         (message "Failed to build manual %s, see buffer %S"
                  file (buffer-name)))
        ((/= 0 (call-process "install-info" nil t nil
-- 
2.39.2


^ permalink raw reply related	[relevance 10%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-07  9:03  5% ` Philip Kaludercic
@ 2023-05-07 18:47  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-08  8:42  0%     ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-10  6:35  5%     ` Philip Kaludercic
  0 siblings, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-07 18:47 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63336

[-- Attachment #1: Type: text/plain, Size: 4915 bytes --]

Thanks for the review!

Philip Kaludercic <philipk@posteo.net> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Hello!
>>
>> Here's a patch to support :make and :shell-command args as discussed:
>>
>> https://lists.gnu.org/archive/html/help-gnu-emacs/2023-04/msg00263.html
>
> Thanks!
>
>> Best,
>>
>> Joseph
>>
>> From c51161c51f11e6ffcba17758424596fe44f9d42a Mon Sep 17 00:00:00 2001
>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Date: Sat, 6 May 2023 13:44:32 -0700
>> Subject: [PATCH] package-vc: Process :make and :shell-command spec args
>>
>> ---
>>  lisp/emacs-lisp/package-vc.el | 32 ++++++++++++++++++++++++++++++++
>>  1 file changed, 32 insertions(+)
>>
>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>> index 421947b528d..489610e2a1e 100644
>> --- a/lisp/emacs-lisp/package-vc.el
>> +++ b/lisp/emacs-lisp/package-vc.el
>> @@ -344,6 +344,35 @@ asynchronously."
>>          "\n")
>>         nil pkg-file nil 'silent))))
>>
>> +(defcustom package-vc-process-make nil
>> +  "If non-nil, process :make and :shell-command spec arguments.
>> +Package specs are loaded from trusted package archives."
>> +  :type 'boolean)
>
> As this patch is going to be added to Emacs 30, we should add
>
>   :version "30.1"
>
> tags to this user option.

Fixed.

>> +(defun package-vc--call (destination program &rest args)
>> +  "Like ‘call-process’ for PROGRAM, DESTINATION, ARGS.
>            ^
> You should replace these quotation marks with regular ASCII `marks', so
> avoid byte-compiler warnings.

Good catch.

>> +The INFILE and DISPLAY arguments are fixed as nil."
>> +  (apply #'call-process program nil destination nil (delq nil args)))
>
> What is the motivation for this function?  Is this where
> process-isolation would be added in the future?

In the attached patch, package-vc--call is replaced with call-process.

>> +(defun package-vc--make (pkg-spec dir)
>> +  "Process :make and :shell-command spec arguments."
>> +  (let ((target (plist-get pkg-spec :make))
>> +        (cmd (plist-get pkg-spec :shell-command)))
>> +    (when (or cmd target)
>> +      (with-current-buffer (get-buffer-create " *package-vc make*")
>                                                  ^
>                                                  should the package name
>                                                  be mentioned here?

I like this idea, but IIUC package-vc--make would then need to take an
extra arg, since pkg-spec doesn't contain the :name of the package. We
could also add :name to the pkg-spec plist?

For comparison, package-vc--build-documentation creates a buffer called
" *package-vc doc*" without the package name.

>> +        (erase-buffer)
>> +        (when (and cmd
>> +                   (/= 0 (package-vc--call t shell-file-name
>> +                                           shell-command-switch
>> +                                           cmd)))
>> +          (message "Failed to run %s, see buffer %S"
>
> Could `warn' be a better candidate here, instead of `message'?

Done.

>> +                   cmd (buffer-name)))
>> +        (when (and target
>> +                   (/= 0 (apply #'package-vc--call t "make"
>> +                                (if (consp target) target (list target)))))
>> +          (message "Failed to make %s, see buffer %S"

And this message is changed to warn also.

>> +                   target (buffer-name)))))))
>> +
>>  (declare-function org-export-to-file "ox" (backend file))
>>
>>  (defun package-vc--build-documentation (pkg-desc file)
>> @@ -486,6 +515,9 @@ documentation and marking the package as installed."
>>        ;; Generate package file
>>        (package-vc--generate-description-file pkg-desc pkg-file)
>>
>> +      ;; Process :make and :shell-command arguments before building documentation
>> +      (when package-vc-process-make (package-vc--make pkg-spec pkg-dir))
>
> Wasn't the plan to allow `package-vc-process-make' to either be a
> generic "build-anything" or a selective listing of packages where we
> allow :make and :shell-command to be executed?

Let me know if the attached commit accomplishes what you had in mind.

>> +
>>        ;; Detect a manual
>>        (when (executable-find "install-info")
>>          (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
>
> Otherwise this looks good, but I haven't tried it out yet.

I fixed up a couple other issues:

- removed unnecessary dir arg to package-vc--make
- added function arg to the docstring for package-vc--make

I'm not sure if the customization type for package-vc-process-make is
correct. Please double check that.

Also, should users be able to run :make and :shell-command args defined
in a spec passed into package-vc-install?

Best,

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-package-vc-Process-make-and-shell-command-spec-args.patch --]
[-- Type: text/x-diff, Size: 2763 bytes --]

From f536b42492e1520cc8da4e92b5bb65552ba39e6a Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 6 May 2023 13:44:32 -0700
Subject: [PATCH] package-vc: Process :make and :shell-command spec args

---
 lisp/emacs-lisp/package-vc.el | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 421947b528d..476c38916a8 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -344,6 +344,31 @@ asynchronously."
         "\n")
        nil pkg-file nil 'silent))))
 
+(defcustom package-vc-process-make nil
+  "Whether to process :make and :shell-command spec arguments.
+
+When set to a list of symbols (packages), run commands for only
+packages in the list. When `nil', never run commands. Otherwise
+when non-`nil', run commands for any package with :make or
+:shell-command specified.
+
+Package specs are loaded from trusted package archives."
+  :type '(choice (boolean :tag "Run for all packages")
+                 (repeat (symbol :tag "Run for only selected packages")))
+  :version "30.1")
+
+(defun package-vc--make (pkg-spec)
+  "Process :make and :shell-command PKG-SPEC arguments."
+  (let ((target (plist-get pkg-spec :make))
+        (cmd (plist-get pkg-spec :shell-command)))
+    (when (or cmd target)
+      (with-current-buffer (get-buffer-create " *package-vc make*")
+        (erase-buffer)
+        (when (and cmd (/= 0 (call-process shell-file-name nil t nil shell-command-switch cmd)))
+          (warn "Failed to run %s, see buffer %S" cmd (buffer-name)))
+        (when (and target (/= 0 (apply #'call-process "make" nil t nil (if (consp target) target (list target)))))
+          (warn "Failed to make %s, see buffer %S" target (buffer-name)))))))
+
 (declare-function org-export-to-file "ox" (backend file))
 
 (defun package-vc--build-documentation (pkg-desc file)
@@ -486,6 +511,16 @@ documentation and marking the package as installed."
       ;; Generate package file
       (package-vc--generate-description-file pkg-desc pkg-file)
 
+      ;; Process :make and :shell-command arguments before building documentation
+      (pcase package-vc-process-make
+        ((pred consp) ; When non-`nil' list, check if package is on the list.
+         (when (memq (package-desc-name pkg-desc) package-vc-process-make)
+           (package-vc--make pkg-spec)))
+        ('nil         ; When `nil', do nothing.
+         nil)
+        (_            ; When otherwise non-`nil', run commands.
+         (package-vc--make pkg-spec)))
+
       ;; Detect a manual
       (when (executable-find "install-info")
         (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
-- 
2.39.2


^ permalink raw reply related	[relevance 8%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-07 18:40 10%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-07 19:11  0%     ` Eli Zaretskii
  2023-05-07 19:19  0%       ` Philip Kaludercic
  2023-05-13  8:41  5%     ` Philip Kaludercic
  1 sibling, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-05-07 19:11 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63337, philipk

> Cc: 63337@debbugs.gnu.org
> Date: Sun, 07 May 2023 11:40:46 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> > According to the docs, makeinfo has -I to append the search path, and -P
> > to prepend.  I don't know how well either of the two are supported, but
> > assuming they are, shouldn't -P be preferred?  Or wouldn't it have any
> > effect?
> 
> I am not sure what difference it would make. I don't know if the default
> @include search path includes anything besides the working directory.

It doesn't, according to the Texinfo manual.  Only the current
directory is searched.

> In the attached diff, I have changed -I to -P.

I think it's a mistake: the current directory should searched first.
So -I is better.





^ permalink raw reply	[relevance 0%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-07 19:11  0%     ` Eli Zaretskii
@ 2023-05-07 19:19  0%       ` Philip Kaludercic
  2023-05-07 20:29  9%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-05-07 19:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63337, Joseph Turner

Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: 63337@debbugs.gnu.org
>> Date: Sun, 07 May 2023 11:40:46 -0700
>> From:  Joseph Turner via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> 
>> > According to the docs, makeinfo has -I to append the search path, and -P
>> > to prepend.  I don't know how well either of the two are supported, but
>> > assuming they are, shouldn't -P be preferred?  Or wouldn't it have any
>> > effect?
>> 
>> I am not sure what difference it would make. I don't know if the default
>> @include search path includes anything besides the working directory.

I don't know that either, and I can imagine that certain versions of
makeinfo might be patched or this could change in the future.

> It doesn't, according to the Texinfo manual.  Only the current
> directory is searched.
>
>> In the attached diff, I have changed -I to -P.
>
> I think it's a mistake: the current directory should searched first.
> So -I is better.

What do we mean by the current directory?  When building the manual from
an org-file, we switch to a temporary directory (where the .org -> .texi
conversion is stored), so the "actual" directory is not the same as the
default-directory.





^ permalink raw reply	[relevance 0%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-07 19:19  0%       ` Philip Kaludercic
@ 2023-05-07 20:29  9%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-08 13:51  5%           ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-07 20:29 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63337, Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 1706 bytes --]


Philip Kaludercic <philipk@posteo.net> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> Cc: 63337@debbugs.gnu.org
>>> Date: Sun, 07 May 2023 11:40:46 -0700
>>> From:  Joseph Turner via "Bug reports for GNU Emacs,
>>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>>
>>> > According to the docs, makeinfo has -I to append the search path, and -P
>>> > to prepend.  I don't know how well either of the two are supported, but
>>> > assuming they are, shouldn't -P be preferred?  Or wouldn't it have any
>>> > effect?
>>>
>>> I am not sure what difference it would make. I don't know if the default
>>> @include search path includes anything besides the working directory.
>
> I don't know that either, and I can imagine that certain versions of
> makeinfo might be patched or this could change in the future.
>
>> It doesn't, according to the Texinfo manual.  Only the current
>> directory is searched.
>>
>>> In the attached diff, I have changed -I to -P.
>>
>> I think it's a mistake: the current directory should searched first.
>> So -I is better.
>
> What do we mean by the current directory?  When building the manual from
> an org-file, we switch to a temporary directory (where the .org -> .texi
> conversion is stored), so the "actual" directory is not the same as the
> default-directory.

AFAICT, makeinfo searches the default-directory. See attached patch,
where we let-bind default-directory to the docs-directory. In this case,
neither -I nor -P is necessary.

It's a bit strange to let-bind default-directory twice in the same
function, but we can't bind it at the top of the function, the
insert-file-contents expects default-directory to be package-desc-dir.

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-package-vc-build-documentation-Relative-include-.patch --]
[-- Type: text/x-diff, Size: 2344 bytes --]

From 7ddfd7ab08820eef159b21047194aaaf4c8841f7 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 6 May 2023 14:49:43 -0700
Subject: [PATCH] Fix: (package-vc--build-documentation) Relative @include
 statements

---
 lisp/emacs-lisp/package-vc.el | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 476c38916a8..c25a96ed942 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -377,6 +377,7 @@ FILE can be an Org file, indicated by its \".org\" extension,
 otherwise it's assumed to be an Info file."
   (let* ((pkg-name (package-desc-name pkg-desc))
          (default-directory (package-desc-dir pkg-desc))
+         (docs-directory (expand-file-name (file-name-directory file)))
          (output (expand-file-name (format "%s.info" pkg-name)))
          clean-up)
     (when (string-match-p "\\.org\\'" file)
@@ -389,16 +390,18 @@ otherwise it's assumed to be an Info file."
         (setq clean-up t)))
     (with-current-buffer (get-buffer-create " *package-vc doc*")
       (erase-buffer)
-      (cond
-       ((/= 0 (call-process "makeinfo" nil t nil
-                            "--no-split" file "-o" output))
-        (message "Failed to build manual %s, see buffer %S"
-                 file (buffer-name)))
-       ((/= 0 (call-process "install-info" nil t nil
-                            output (expand-file-name "dir")))
-        (message "Failed to install manual %s, see buffer %S"
-                 output (buffer-name)))
-       ((kill-buffer))))
+      (let ((default-directory docs-directory))
+        ;; `let'-bind `default-directory' so that makeinfo resolves
+        ;; relative @include statements in the docs directory
+        (cond
+         ((/= 0 (call-process "makeinfo" nil t nil "--no-split" file "-o" output))
+          (message "Failed to build manual %s, see buffer %S"
+                   file (buffer-name)))
+         ((/= 0 (call-process "install-info" nil t nil
+                              output (expand-file-name "dir")))
+          (message "Failed to install manual %s, see buffer %S"
+                   output (buffer-name)))
+         ((kill-buffer)))))
     (when clean-up
       (delete-file file))))
 
-- 
2.39.2


^ permalink raw reply related	[relevance 9%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-07 18:47  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-08  8:42  0%     ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-08 19:38  9%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-10  6:35  5%     ` Philip Kaludercic
  1 sibling, 1 reply; 200+ results
From: Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-08  8:42 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63336, Philip Kaludercic

Hello Joseph, 

On mobile so please excuse my brevity and top-posting. 

Minor remark on the defcustom type: I think you should move the current tag from "symbol" to its outer "repeat", and optionally tag "symbol" as something like "package name".  WDYT? 

--
Best, 


RY

> On May 8, 2023, at 04:29, Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs@gnu.org> wrote:
> 
> Thanks for the review!
> 
> Philip Kaludercic <philipk@posteo.net> writes:
> 
>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>> 
>>> Hello!
>>> 
>>> Here's a patch to support :make and :shell-command args as discussed:
>>> 
>>> https://lists.gnu.org/archive/html/help-gnu-emacs/2023-04/msg00263.html
>> 
>> Thanks!
>> 
>>> Best,
>>> 
>>> Joseph
>>> 
>>> From c51161c51f11e6ffcba17758424596fe44f9d42a Mon Sep 17 00:00:00 2001
>>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>>> Date: Sat, 6 May 2023 13:44:32 -0700
>>> Subject: [PATCH] package-vc: Process :make and :shell-command spec args
>>> 
>>> ---
>>> lisp/emacs-lisp/package-vc.el | 32 ++++++++++++++++++++++++++++++++
>>> 1 file changed, 32 insertions(+)
>>> 
>>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>>> index 421947b528d..489610e2a1e 100644
>>> --- a/lisp/emacs-lisp/package-vc.el
>>> +++ b/lisp/emacs-lisp/package-vc.el
>>> @@ -344,6 +344,35 @@ asynchronously."
>>>         "\n")
>>>        nil pkg-file nil 'silent))))
>>> 
>>> +(defcustom package-vc-process-make nil
>>> +  "If non-nil, process :make and :shell-command spec arguments.
>>> +Package specs are loaded from trusted package archives."
>>> +  :type 'boolean)
>> 
>> As this patch is going to be added to Emacs 30, we should add
>> 
>>  :version "30.1"
>> 
>> tags to this user option.
> 
> Fixed.
> 
>>> +(defun package-vc--call (destination program &rest args)
>>> +  "Like ‘call-process’ for PROGRAM, DESTINATION, ARGS.
>>           ^
>> You should replace these quotation marks with regular ASCII `marks', so
>> avoid byte-compiler warnings.
> 
> Good catch.
> 
>>> +The INFILE and DISPLAY arguments are fixed as nil."
>>> +  (apply #'call-process program nil destination nil (delq nil args)))
>> 
>> What is the motivation for this function?  Is this where
>> process-isolation would be added in the future?
> 
> In the attached patch, package-vc--call is replaced with call-process.
> 
>>> +(defun package-vc--make (pkg-spec dir)
>>> +  "Process :make and :shell-command spec arguments."
>>> +  (let ((target (plist-get pkg-spec :make))
>>> +        (cmd (plist-get pkg-spec :shell-command)))
>>> +    (when (or cmd target)
>>> +      (with-current-buffer (get-buffer-create " *package-vc make*")
>>                                                 ^
>>                                                 should the package name
>>                                                 be mentioned here?
> 
> I like this idea, but IIUC package-vc--make would then need to take an
> extra arg, since pkg-spec doesn't contain the :name of the package. We
> could also add :name to the pkg-spec plist?
> 
> For comparison, package-vc--build-documentation creates a buffer called
> " *package-vc doc*" without the package name.
> 
>>> +        (erase-buffer)
>>> +        (when (and cmd
>>> +                   (/= 0 (package-vc--call t shell-file-name
>>> +                                           shell-command-switch
>>> +                                           cmd)))
>>> +          (message "Failed to run %s, see buffer %S"
>> 
>> Could `warn' be a better candidate here, instead of `message'?
> 
> Done.
> 
>>> +                   cmd (buffer-name)))
>>> +        (when (and target
>>> +                   (/= 0 (apply #'package-vc--call t "make"
>>> +                                (if (consp target) target (list target)))))
>>> +          (message "Failed to make %s, see buffer %S"
> 
> And this message is changed to warn also.
> 
>>> +                   target (buffer-name)))))))
>>> +
>>> (declare-function org-export-to-file "ox" (backend file))
>>> 
>>> (defun package-vc--build-documentation (pkg-desc file)
>>> @@ -486,6 +515,9 @@ documentation and marking the package as installed."
>>>       ;; Generate package file
>>>       (package-vc--generate-description-file pkg-desc pkg-file)
>>> 
>>> +      ;; Process :make and :shell-command arguments before building documentation
>>> +      (when package-vc-process-make (package-vc--make pkg-spec pkg-dir))
>> 
>> Wasn't the plan to allow `package-vc-process-make' to either be a
>> generic "build-anything" or a selective listing of packages where we
>> allow :make and :shell-command to be executed?
> 
> Let me know if the attached commit accomplishes what you had in mind.
> 
>>> +
>>>       ;; Detect a manual
>>>       (when (executable-find "install-info")
>>>         (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
>> 
>> Otherwise this looks good, but I haven't tried it out yet.
> 
> I fixed up a couple other issues:
> 
> - removed unnecessary dir arg to package-vc--make
> - added function arg to the docstring for package-vc--make
> 
> I'm not sure if the customization type for package-vc-process-make is
> correct. Please double check that.
> 
> Also, should users be able to run :make and :shell-command args defined
> in a spec passed into package-vc-install?
> 
> Best,
> 
> Joseph
> 
> <0001-package-vc-Process-make-and-shell-command-spec-args.patch>






^ permalink raw reply	[relevance 0%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-07 20:29  9%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-08 13:51  5%           ` Philip Kaludercic
  2023-05-08 19:05  9%             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-05-08 13:51 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63337, Eli Zaretskii

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>>>> Cc: 63337@debbugs.gnu.org
>>>> Date: Sun, 07 May 2023 11:40:46 -0700
>>>> From:  Joseph Turner via "Bug reports for GNU Emacs,
>>>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>>>
>>>> > According to the docs, makeinfo has -I to append the search path, and -P
>>>> > to prepend.  I don't know how well either of the two are supported, but
>>>> > assuming they are, shouldn't -P be preferred?  Or wouldn't it have any
>>>> > effect?
>>>>
>>>> I am not sure what difference it would make. I don't know if the default
>>>> @include search path includes anything besides the working directory.
>>
>> I don't know that either, and I can imagine that certain versions of
>> makeinfo might be patched or this could change in the future.
>>
>>> It doesn't, according to the Texinfo manual.  Only the current
>>> directory is searched.
>>>
>>>> In the attached diff, I have changed -I to -P.
>>>
>>> I think it's a mistake: the current directory should searched first.
>>> So -I is better.
>>
>> What do we mean by the current directory?  When building the manual from
>> an org-file, we switch to a temporary directory (where the .org -> .texi
>> conversion is stored), so the "actual" directory is not the same as the
>> default-directory.
>
> AFAICT, makeinfo searches the default-directory. See attached patch,
> where we let-bind default-directory to the docs-directory. In this case,
> neither -I nor -P is necessary.
>
> It's a bit strange to let-bind default-directory twice in the same
> function, but we can't bind it at the top of the function, the
> insert-file-contents expects default-directory to be package-desc-dir.

It might be, but I'll have to look into that in more detail, that the
first default-directory binding is not necessary if we pass
(package-desc-dir pkg-desc) as the second argument to `expand-file-name'
when binding `output'.  Then this would all be simplified, and we could
avoid the confusion you mention.

> Joseph
>
> From 7ddfd7ab08820eef159b21047194aaaf4c8841f7 Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Sat, 6 May 2023 14:49:43 -0700
> Subject: [PATCH] Fix: (package-vc--build-documentation) Relative @include
>  statements
>
> ---
>  lisp/emacs-lisp/package-vc.el | 23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index 476c38916a8..c25a96ed942 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -377,6 +377,7 @@ FILE can be an Org file, indicated by its \".org\" extension,
>  otherwise it's assumed to be an Info file."
>    (let* ((pkg-name (package-desc-name pkg-desc))
>           (default-directory (package-desc-dir pkg-desc))
> +         (docs-directory (expand-file-name (file-name-directory file)))
>           (output (expand-file-name (format "%s.info" pkg-name)))
>           clean-up)
>      (when (string-match-p "\\.org\\'" file)
> @@ -389,16 +390,18 @@ otherwise it's assumed to be an Info file."
>          (setq clean-up t)))
>      (with-current-buffer (get-buffer-create " *package-vc doc*")
>        (erase-buffer)
> -      (cond
> -       ((/= 0 (call-process "makeinfo" nil t nil
> -                            "--no-split" file "-o" output))
> -        (message "Failed to build manual %s, see buffer %S"
> -                 file (buffer-name)))
> -       ((/= 0 (call-process "install-info" nil t nil
> -                            output (expand-file-name "dir")))
> -        (message "Failed to install manual %s, see buffer %S"
> -                 output (buffer-name)))
> -       ((kill-buffer))))
> +      (let ((default-directory docs-directory))
> +        ;; `let'-bind `default-directory' so that makeinfo resolves
> +        ;; relative @include statements in the docs directory
> +        (cond
> +         ((/= 0 (call-process "makeinfo" nil t nil "--no-split" file "-o" output))
> +          (message "Failed to build manual %s, see buffer %S"
> +                   file (buffer-name)))
> +         ((/= 0 (call-process "install-info" nil t nil
> +                              output (expand-file-name "dir")))
> +          (message "Failed to install manual %s, see buffer %S"
> +                   output (buffer-name)))
> +         ((kill-buffer)))))
>      (when clean-up
>        (delete-file file))))





^ permalink raw reply	[relevance 5%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-08 13:51  5%           ` Philip Kaludercic
@ 2023-05-08 19:05  9%             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-09  1:34  5%               ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-09  4:36  0%               ` Eli Zaretskii
  0 siblings, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-08 19:05 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63337, Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]


Philip Kaludercic <philipk@posteo.net> writes:

> It might be, but I'll have to look into that in more detail, that the
> first default-directory binding is not necessary if we pass
> (package-desc-dir pkg-desc) as the second argument to `expand-file-name'
> when binding `output'.  Then this would all be simplified, and we could
> avoid the confusion you mention.

While this would mean binding default-directory only once, it still
requires two `let'-bindings.

The solution in the attached patch requires only one let-binding while
changing the behavior of package-vc--build-documentation slightly. Now
the output .info file is put inside the same directory as FILE, instead
of inside the directory returned by (package-desc-dir pkg-desc).

Note about the following two lines:

+ (file-path (expand-file-name file (package-desc-dir pkg-desc)))
+ (default-directory (expand-file-name (file-name-directory file-path)))

(package-desc-dir pkg-desc) may return a relative path with or without a
directory, e.g. "doc/manual.org" or "manual.org". In the latter case,
(file-name-directory "manual.org") would return `nil' and
(expand-file-name nil) would signal an error.

Therefore, in the `file-path' `let'-binding, we first expand the return
value of (package-desc-dir pkg-desc) to ensure that it contains a directory.

Best,

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-package-vc-build-documentation-Relative-include-.patch --]
[-- Type: text/x-diff, Size: 1588 bytes --]

From 2cf2d522818c75ff5626324251bb74cdc3c36dc7 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 6 May 2023 14:49:43 -0700
Subject: [PATCH] Fix: (package-vc--build-documentation) Relative @include
 statements

---
 lisp/emacs-lisp/package-vc.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 476c38916a8..65767cf043a 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -376,14 +376,17 @@ Package specs are loaded from trusted package archives."
 FILE can be an Org file, indicated by its \".org\" extension,
 otherwise it's assumed to be an Info file."
   (let* ((pkg-name (package-desc-name pkg-desc))
-         (default-directory (package-desc-dir pkg-desc))
+         (file-path (expand-file-name file (package-desc-dir pkg-desc)))
+         ;; `let'-bind `default-directory' to the directory containing the .org or .info FILE
+         ;; so that makeinfo can resolve relative @include statements in the docs directory.
+         (default-directory (expand-file-name (file-name-directory file-path)))
          (output (expand-file-name (format "%s.info" pkg-name)))
          clean-up)
     (when (string-match-p "\\.org\\'" file)
       (require 'ox)
       (require 'ox-texinfo)
       (with-temp-buffer
-        (insert-file-contents file)
+        (insert-file-contents file-path)
         (setq file (make-temp-file "ox-texinfo-"))
         (org-export-to-file 'texinfo file)
         (setq clean-up t)))
-- 
2.39.2


^ permalink raw reply related	[relevance 9%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-08  8:42  0%     ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-08 19:38  9%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-08 19:38 UTC (permalink / raw)
  To: Ruijie Yu; +Cc: 63336, Philip Kaludercic

[-- Attachment #1: Type: text/plain, Size: 368 bytes --]

Ruijie Yu <ruijie@netyu.xyz> writes:

> Hello Joseph,
>
> On mobile so please excuse my brevity and top-posting.
>
> Minor remark on the defcustom type: I think you should move the current tag from "symbol" to its outer "repeat", and optionally tag "symbol" as something like "package name".  WDYT?

Thanks, Ruijie! I think the defcustom type is now correct.

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-package-vc-Process-make-and-shell-command-spec-args.patch --]
[-- Type: text/x-diff, Size: 2830 bytes --]

From 8f9238b841f6deec65fd52d696aa26caf1bf123a Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 6 May 2023 13:44:32 -0700
Subject: [PATCH] package-vc: Process :make and :shell-command spec args

---
 lisp/emacs-lisp/package-vc.el | 36 +++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 421947b528d..95e12fc829a 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -344,6 +344,32 @@ asynchronously."
         "\n")
        nil pkg-file nil 'silent))))
 
+(defcustom package-vc-process-make nil
+  "Whether to process :make and :shell-command spec arguments.
+
+When set to a list of symbols (packages), run commands for only
+packages in the list. When `nil', never run commands. Otherwise
+when non-`nil', run commands for any package with :make or
+:shell-command specified.
+
+Package specs are loaded from trusted package archives."
+  :type '(choice (const :tag "Run for all packages" t)
+                 (repeat :tag "Run only for selected packages" (symbol :tag "Package name"))
+                 (const :tag "Never run" nil))
+  :version "30.1")
+
+(defun package-vc--make (pkg-spec)
+  "Process :make and :shell-command PKG-SPEC arguments."
+  (let ((target (plist-get pkg-spec :make))
+        (cmd (plist-get pkg-spec :shell-command)))
+    (when (or cmd target)
+      (with-current-buffer (get-buffer-create " *package-vc make*")
+        (erase-buffer)
+        (when (and cmd (/= 0 (call-process shell-file-name nil t nil shell-command-switch cmd)))
+          (warn "Failed to run %s, see buffer %S" cmd (buffer-name)))
+        (when (and target (/= 0 (apply #'call-process "make" nil t nil (if (consp target) target (list target)))))
+          (warn "Failed to make %s, see buffer %S" target (buffer-name)))))))
+
 (declare-function org-export-to-file "ox" (backend file))
 
 (defun package-vc--build-documentation (pkg-desc file)
@@ -486,6 +512,16 @@ documentation and marking the package as installed."
       ;; Generate package file
       (package-vc--generate-description-file pkg-desc pkg-file)
 
+      ;; Process :make and :shell-command arguments before building documentation
+      (pcase package-vc-process-make
+        ((pred consp) ; When non-`nil' list, check if package is on the list.
+         (when (memq (package-desc-name pkg-desc) package-vc-process-make)
+           (package-vc--make pkg-spec)))
+        ('nil         ; When `nil', do nothing.
+         nil)
+        (_            ; When otherwise non-`nil', run commands.
+         (package-vc--make pkg-spec)))
+
       ;; Detect a manual
       (when (executable-find "install-info")
         (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
-- 
2.39.2


^ permalink raw reply related	[relevance 9%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-08 19:05  9%             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-09  1:34  5%               ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-09  2:48  5%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-09  4:36  0%               ` Eli Zaretskii
  1 sibling, 1 reply; 200+ results
From: Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-09  1:34 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63337, philipk, eliz


Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> writes:

> + (file-path (expand-file-name file (package-desc-dir pkg-desc)))
> + (default-directory (expand-file-name (file-name-directory file-path)))
>
> (package-desc-dir pkg-desc) may return a relative path with or without a
> directory, e.g. "doc/manual.org" or "manual.org". In the latter case,
> (file-name-directory "manual.org") would return `nil' and
> (expand-file-name nil) would signal an error.

In this case, can't you do this instead:

    (expand-file-name (or (file-name-directory ...) "."))

?

-- 
Best,


RY





^ permalink raw reply	[relevance 5%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-09  1:34  5%               ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-09  2:48  5%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-09  2:48 UTC (permalink / raw)
  To: Ruijie Yu; +Cc: 63337, philipk, eliz


Ruijie Yu <ruijie@netyu.xyz> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> writes:
>
>> + (file-path (expand-file-name file (package-desc-dir pkg-desc)))
>> + (default-directory (expand-file-name (file-name-directory file-path)))
>>
>> (package-desc-dir pkg-desc) may return a relative path with or without a
>> directory, e.g. "doc/manual.org" or "manual.org". In the latter case,
>> (file-name-directory "manual.org") would return `nil' and
>> (expand-file-name nil) would signal an error.
>
> In this case, can't you do this instead:
>
>     (expand-file-name (or (file-name-directory ...) "."))

Yes, we could do this, but we make use of FILE-PATH anyway. We can't use
FILE after DEFAULT-DIRECTORY has been set the file containing FILE.

The choice is between

(file-name-directory file-path)

and

(or (file-name-directory file) ".")

I think the intent comes across more clearly in the former.

Joseph





^ permalink raw reply	[relevance 5%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-08 19:05  9%             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-09  1:34  5%               ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-09  4:36  0%               ` Eli Zaretskii
  2023-05-09 23:49 10%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-05-09  4:36 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63337, philipk

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: Eli Zaretskii <eliz@gnu.org>, 63337@debbugs.gnu.org
> Date: Mon, 08 May 2023 12:05:51 -0700
> 
> Note about the following two lines:
> 
> + (file-path (expand-file-name file (package-desc-dir pkg-desc)))
> + (default-directory (expand-file-name (file-name-directory file-path)))
> 
> (package-desc-dir pkg-desc) may return a relative path with or without a
> directory, e.g. "doc/manual.org" or "manual.org". In the latter case,
> (file-name-directory "manual.org") would return `nil' and
> (expand-file-name nil) would signal an error.
> 
> Therefore, in the `file-path' `let'-binding, we first expand the return
> value of (package-desc-dir pkg-desc) to ensure that it contains a directory.

Please don't use "path" for anything that is not a PATH-style list of
directory: the GNU Coding Standards frown on such usage.  We use
file-name instead.  For the same reasons, please don't give your
variables names that include "path" unless they are lists of
directories.

> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -376,14 +376,17 @@ Package specs are loaded from trusted package archives."
>  FILE can be an Org file, indicated by its \".org\" extension,
>  otherwise it's assumed to be an Info file."
>    (let* ((pkg-name (package-desc-name pkg-desc))
> -         (default-directory (package-desc-dir pkg-desc))
> +         (file-path (expand-file-name file (package-desc-dir pkg-desc)))
> +         ;; `let'-bind `default-directory' to the directory containing the .org or .info FILE
> +         ;; so that makeinfo can resolve relative @include statements in the docs directory.
> +         (default-directory (expand-file-name (file-name-directory file-path)))

There should be no reason to call expand-file-name in the last line,
since the argument of file-name-directory is already expanded.

Also, please make the comment lines shorter, preferably less than 75
columns.

Thanks.





^ permalink raw reply	[relevance 0%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-09  4:36  0%               ` Eli Zaretskii
@ 2023-05-09 23:49 10%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-10  6:51  5%                   ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-09 23:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63337, philipk

[-- Attachment #1: Type: text/plain, Size: 2167 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:

>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Cc: Eli Zaretskii <eliz@gnu.org>, 63337@debbugs.gnu.org
>> Date: Mon, 08 May 2023 12:05:51 -0700
>>
>> Note about the following two lines:
>>
>> + (file-path (expand-file-name file (package-desc-dir pkg-desc)))
>> + (default-directory (expand-file-name (file-name-directory file-path)))
>>
>> (package-desc-dir pkg-desc) may return a relative path with or without a
>> directory, e.g. "doc/manual.org" or "manual.org". In the latter case,
>> (file-name-directory "manual.org") would return `nil' and
>> (expand-file-name nil) would signal an error.
>>
>> Therefore, in the `file-path' `let'-binding, we first expand the return
>> value of (package-desc-dir pkg-desc) to ensure that it contains a directory.
>
> Please don't use "path" for anything that is not a PATH-style list of
> directory: the GNU Coding Standards frown on such usage.  We use
> file-name instead.  For the same reasons, please don't give your
> variables names that include "path" unless they are lists of
> directories.

Good to know, thank you! I changed `file-path' to `file-name'.

>> --- a/lisp/emacs-lisp/package-vc.el
>> +++ b/lisp/emacs-lisp/package-vc.el
>> @@ -376,14 +376,17 @@ Package specs are loaded from trusted package archives."
>>  FILE can be an Org file, indicated by its \".org\" extension,
>>  otherwise it's assumed to be an Info file."
>>    (let* ((pkg-name (package-desc-name pkg-desc))
>> -         (default-directory (package-desc-dir pkg-desc))
>> +         (file-path (expand-file-name file (package-desc-dir pkg-desc)))
>> +         ;; `let'-bind `default-directory' to the directory containing the .org or .info FILE
>> +         ;; so that makeinfo can resolve relative @include statements in the docs directory.
>> +         (default-directory (expand-file-name (file-name-directory file-path)))
>
> There should be no reason to call expand-file-name in the last line,
> since the argument of file-name-directory is already expanded.

Good catch! Fixed.

> Also, please make the comment lines shorter, preferably less than 75
> columns.

Done.

Thank you!!

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-package-vc-build-documentation-Relative-include-.patch --]
[-- Type: text/x-diff, Size: 1583 bytes --]

From c670f47ef55b41265c064a2d4ab1e56c46e57272 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 6 May 2023 14:49:43 -0700
Subject: [PATCH] Fix: (package-vc--build-documentation) Relative @include
 statements

---
 lisp/emacs-lisp/package-vc.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 95e12fc829a..efcfd635e98 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -377,14 +377,18 @@ Package specs are loaded from trusted package archives."
 FILE can be an Org file, indicated by its \".org\" extension,
 otherwise it's assumed to be an Info file."
   (let* ((pkg-name (package-desc-name pkg-desc))
-         (default-directory (package-desc-dir pkg-desc))
+         (file-name (expand-file-name file (package-desc-dir pkg-desc)))
+         ;; `let'-bind `default-directory' to the directory containing
+         ;; the .org or .info FILE so that makeinfo can resolve
+         ;; relative @include statements in the docs directory.
+         (default-directory (file-name-directory file-name))
          (output (expand-file-name (format "%s.info" pkg-name)))
          clean-up)
     (when (string-match-p "\\.org\\'" file)
       (require 'ox)
       (require 'ox-texinfo)
       (with-temp-buffer
-        (insert-file-contents file)
+        (insert-file-contents file-name)
         (setq file (make-temp-file "ox-texinfo-"))
         (org-export-to-file 'texinfo file)
         (setq clean-up t)))
-- 
2.39.2


^ permalink raw reply related	[relevance 10%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-07 18:47  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-08  8:42  0%     ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-10  6:35  5%     ` Philip Kaludercic
  2023-05-11  1:37  9%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-13 17:18  0%       ` Philip Kaludercic
  1 sibling, 2 replies; 200+ results
From: Philip Kaludercic @ 2023-05-10  6:35 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63336

Joseph Turner <joseph@breatheoutbreathe.in> writes:

>>> +(defun package-vc--make (pkg-spec dir)
>>> +  "Process :make and :shell-command spec arguments."
>>> +  (let ((target (plist-get pkg-spec :make))
>>> +        (cmd (plist-get pkg-spec :shell-command)))
>>> +    (when (or cmd target)
>>> +      (with-current-buffer (get-buffer-create " *package-vc make*")
>>                                                  ^
>>                                                  should the package name
>>                                                  be mentioned here?
>
> I like this idea, but IIUC package-vc--make would then need to take an
> extra arg, since pkg-spec doesn't contain the :name of the package. We
> could also add :name to the pkg-spec plist?

I wouldn't be in favour of that, I think that passing the name as a
separate argument would be a better solution.

> For comparison, package-vc--build-documentation creates a buffer called
> " *package-vc doc*" without the package name.

The difference I see here is that documentation usually builds fine,
while :make or :shell-command have a higher chance of failing because
some software is missing, especially if people don't use :make the way
it is used on the ELPA server but to build external dependencies (I'm
thinking of mail clients like notmuch)

>>> +                   target (buffer-name)))))))
>>> +
>>>  (declare-function org-export-to-file "ox" (backend file))
>>>
>>>  (defun package-vc--build-documentation (pkg-desc file)
>>> @@ -486,6 +515,9 @@ documentation and marking the package as installed."
>>>        ;; Generate package file
>>>        (package-vc--generate-description-file pkg-desc pkg-file)
>>>
>>> +      ;; Process :make and :shell-command arguments before building documentation
>>> +      (when package-vc-process-make (package-vc--make pkg-spec pkg-dir))
>>
>> Wasn't the plan to allow `package-vc-process-make' to either be a
>> generic "build-anything" or a selective listing of packages where we
>> allow :make and :shell-command to be executed?
>
> Let me know if the attached commit accomplishes what you had in mind.

Yes, that (or rather the newest version from a different message) looks good.

>>> +
>>>        ;; Detect a manual
>>>        (when (executable-find "install-info")
>>>          (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
>>
>> Otherwise this looks good, but I haven't tried it out yet.
>
> I fixed up a couple other issues:
>
> - removed unnecessary dir arg to package-vc--make
> - added function arg to the docstring for package-vc--make
>
> I'm not sure if the customization type for package-vc-process-make is
> correct. Please double check that.
>
> Also, should users be able to run :make and :shell-command args defined
> in a spec passed into package-vc-install?

Yes, is that currently not supported?

> Best,
>
> Joseph





^ permalink raw reply	[relevance 5%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-09 23:49 10%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-10  6:51  5%                   ` Philip Kaludercic
  2023-05-11  2:04  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-05-10  6:51 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63337, Eli Zaretskii

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>>> Cc: Eli Zaretskii <eliz@gnu.org>, 63337@debbugs.gnu.org
>>> Date: Mon, 08 May 2023 12:05:51 -0700
>>>
>>> Note about the following two lines:
>>>
>>> + (file-path (expand-file-name file (package-desc-dir pkg-desc)))
>>> + (default-directory (expand-file-name (file-name-directory file-path)))
>>>
>>> (package-desc-dir pkg-desc) may return a relative path with or without a
>>> directory, e.g. "doc/manual.org" or "manual.org". In the latter case,
>>> (file-name-directory "manual.org") would return `nil' and
>>> (expand-file-name nil) would signal an error.
>>>
>>> Therefore, in the `file-path' `let'-binding, we first expand the return
>>> value of (package-desc-dir pkg-desc) to ensure that it contains a directory.
>>
>> Please don't use "path" for anything that is not a PATH-style list of
>> directory: the GNU Coding Standards frown on such usage.  We use
>> file-name instead.  For the same reasons, please don't give your
>> variables names that include "path" unless they are lists of
>> directories.
>
> Good to know, thank you! I changed `file-path' to `file-name'.
>
>>> --- a/lisp/emacs-lisp/package-vc.el
>>> +++ b/lisp/emacs-lisp/package-vc.el
>>> @@ -376,14 +376,17 @@ Package specs are loaded from trusted package archives."
>>>  FILE can be an Org file, indicated by its \".org\" extension,
>>>  otherwise it's assumed to be an Info file."
>>>    (let* ((pkg-name (package-desc-name pkg-desc))
>>> -         (default-directory (package-desc-dir pkg-desc))
>>> +         (file-path (expand-file-name file (package-desc-dir pkg-desc)))
>>> +         ;; `let'-bind `default-directory' to the directory containing the .org or .info FILE
>>> +         ;; so that makeinfo can resolve relative @include statements in the docs directory.
>>> +         (default-directory (expand-file-name (file-name-directory file-path)))
>>
>> There should be no reason to call expand-file-name in the last line,
>> since the argument of file-name-directory is already expanded.
>
> Good catch! Fixed.
>
>> Also, please make the comment lines shorter, preferably less than 75
>> columns.
>
> Done.
>
> Thank you!!
>
> Joseph

Ok, do you have a few example repositories that we can use to test edge-cases?





^ permalink raw reply	[relevance 5%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-10  6:35  5%     ` Philip Kaludercic
@ 2023-05-11  1:37  9%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-14  7:44  5%         ` Philip Kaludercic
  2023-05-13 17:18  0%       ` Philip Kaludercic
  1 sibling, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-11  1:37 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63336

[-- Attachment #1: Type: text/plain, Size: 3378 bytes --]


Philip Kaludercic <philipk@posteo.net> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>>>> +(defun package-vc--make (pkg-spec dir)
>>>> +  "Process :make and :shell-command spec arguments."
>>>> +  (let ((target (plist-get pkg-spec :make))
>>>> +        (cmd (plist-get pkg-spec :shell-command)))
>>>> +    (when (or cmd target)
>>>> +      (with-current-buffer (get-buffer-create " *package-vc make*")
>>>                                                  ^
>>>                                                  should the package name
>>>                                                  be mentioned here?
>>
>> I like this idea, but IIUC package-vc--make would then need to take an
>> extra arg, since pkg-spec doesn't contain the :name of the package. We
>> could also add :name to the pkg-spec plist?
>
> I wouldn't be in favour of that, I think that passing the name as a
> separate argument would be a better solution.

I agree.

>> For comparison, package-vc--build-documentation creates a buffer called
>> " *package-vc doc*" without the package name.
>
> The difference I see here is that documentation usually builds fine,
> while :make or :shell-command have a higher chance of failing because
> some software is missing, especially if people don't use :make the way
> it is used on the ELPA server but to build external dependencies (I'm
> thinking of mail clients like notmuch)

That makes sense to me. In the attached patch, I pass pkg-desc to
package-vc--make instead just name.

Want me to submit a separate patch which adds the package name to the
" *package-vc doc*" buffer name?

>>>> +                   target (buffer-name)))))))
>>>> +
>>>>  (declare-function org-export-to-file "ox" (backend file))
>>>>
>>>>  (defun package-vc--build-documentation (pkg-desc file)
>>>> @@ -486,6 +515,9 @@ documentation and marking the package as installed."
>>>>        ;; Generate package file
>>>>        (package-vc--generate-description-file pkg-desc pkg-file)
>>>>
>>>> +      ;; Process :make and :shell-command arguments before building documentation
>>>> +      (when package-vc-process-make (package-vc--make pkg-spec pkg-dir))
>>>
>>> Wasn't the plan to allow `package-vc-process-make' to either be a
>>> generic "build-anything" or a selective listing of packages where we
>>> allow :make and :shell-command to be executed?
>>
>> Let me know if the attached commit accomplishes what you had in mind.
>
> Yes, that (or rather the newest version from a different message) looks good.
>
>>>> +
>>>>        ;; Detect a manual
>>>>        (when (executable-find "install-info")
>>>>          (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
>>>
>>> Otherwise this looks good, but I haven't tried it out yet.
>>
>> I fixed up a couple other issues:
>>
>> - removed unnecessary dir arg to package-vc--make
>> - added function arg to the docstring for package-vc--make
>>
>> I'm not sure if the customization type for package-vc-process-make is
>> correct. Please double check that.
>>
>> Also, should users be able to run :make and :shell-command args defined
>> in a spec passed into package-vc-install?
>
> Yes, is that currently not supported?

Nevermind! It is supported. I didn't notice that package-vc--unpack adds
the user-defined pkg-spec to package-vc-selected-packages just before
calling package-vc--unpack-1.

Best,

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-package-vc-Process-make-and-shell-command-spec-args.patch --]
[-- Type: text/x-diff, Size: 2941 bytes --]

From b27724197acd4ee72f9d336843f0e6ed9fcee87b Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 13 May 2023 10:05:04 -0700
Subject: [PATCH] package-vc: Process :make and :shell-command spec args

---
 lisp/emacs-lisp/package-vc.el | 37 +++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index beca0bd00e2..8529d1dad5c 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -344,6 +344,33 @@ asynchronously."
         "\n")
        nil pkg-file nil 'silent))))
 
+(defcustom package-vc-process-make nil
+  "Whether to process :make and :shell-command spec arguments.
+
+When set to a list of symbols (packages), run commands for only
+packages in the list. When `nil', never run commands. Otherwise
+when non-`nil', run commands for any package with :make or
+:shell-command specified.
+
+Package specs are loaded from trusted package archives."
+  :type '(choice (const :tag "Run for all packages" t)
+                 (repeat :tag "Run only for selected packages" (symbol :tag "Package name"))
+                 (const :tag "Never run" nil))
+  :version "30.1")
+
+(defun package-vc--make (pkg-spec pkg-desc)
+  "Process :make and :shell-command PKG-SPEC arguments for PKG-DESC."
+  (let ((target (plist-get pkg-spec :make))
+        (cmd (plist-get pkg-spec :shell-command)))
+    (when (or cmd target)
+      (with-current-buffer (get-buffer-create
+                            (format " *package-vc make %s*" (package-desc-name pkg-desc)))
+        (erase-buffer)
+        (when (and cmd (/= 0 (call-process shell-file-name nil t nil shell-command-switch cmd)))
+          (warn "Failed to run %s, see buffer %S" cmd (buffer-name)))
+        (when (and target (/= 0 (apply #'call-process "make" nil t nil (if (consp target) target (list target)))))
+          (warn "Failed to make %s, see buffer %S" target (buffer-name)))))))
+
 (declare-function org-export-to-file "ox" (backend file))
 
 (defun package-vc--build-documentation (pkg-desc file)
@@ -486,6 +513,16 @@ documentation and marking the package as installed."
       ;; Generate package file
       (package-vc--generate-description-file pkg-desc pkg-file)
 
+      ;; Process :make and :shell-command arguments before building documentation
+      (pcase package-vc-process-make
+        ((pred consp) ; When non-`nil' list, check if package is on the list.
+         (when (memq (package-desc-name pkg-desc) package-vc-process-make)
+           (package-vc--make pkg-spec pkg-desc)))
+        ('nil         ; When `nil', do nothing.
+         nil)
+        (_            ; When otherwise non-`nil', run commands.
+         (package-vc--make pkg-spec pkg-desc)))
+
       ;; Detect a manual
       (when (executable-find "install-info")
         (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
-- 
2.40.1


^ permalink raw reply related	[relevance 9%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-10  6:51  5%                   ` Philip Kaludercic
@ 2023-05-11  2:04  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-12  6:51  5%                       ` Philip Kaludercic
  2023-05-12  6:56  5%                       ` Philip Kaludercic
  0 siblings, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-11  2:04 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63337, Eli Zaretskii


Philip Kaludercic <philipk@posteo.net> writes:

> Ok, do you have a few example repositories that we can use to test edge-cases?

I first noticed this issue when attempting to build the docs for
org-transclusion. Besides that, we could select a few package specs
containing :make at random from
https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/elpa-packages ?

Joseph





^ permalink raw reply	[relevance 5%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-11  2:04  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-12  6:51  5%                       ` Philip Kaludercic
    2023-05-12  6:56  5%                       ` Philip Kaludercic
  1 sibling, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-05-12  6:51 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63337, Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 686 bytes --]

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Ok, do you have a few example repositories that we can use to test edge-cases?
>
> I first noticed this issue when attempting to build the docs for
> org-transclusion. Besides that, we could select a few package specs
> containing :make at random from
> https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/elpa-packages ?

One issue I still notice in this case is that if the file doesn't exist,
the issue is raised by `insert-file-contents' which aborts the entire
installation.  Does checking the existence of the file, and continuing
on if this is not the case make sense:


[-- Attachment #2: Type: text/plain, Size: 2453 bytes --]

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index e9794eac783..1c1492d87b2 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -353,28 +353,30 @@ package-vc--build-documentation
          (default-directory (file-name-directory file-name))
          (output (expand-file-name (format "%s.info" pkg-name)))
          clean-up)
-    (when (string-match-p "\\.org\\'" file)
-      (require 'ox)
-      (require 'ox-texinfo)
-      (with-temp-buffer
-        (insert-file-contents file-name)
-        (setq file (make-temp-file "ox-texinfo-"))
-        (org-export-to-file 'texinfo file)
-        (setq clean-up t)))
-    (with-current-buffer (get-buffer-create " *package-vc doc*")
-      (erase-buffer)
-      (cond
-       ((/= 0 (call-process "makeinfo" nil t nil
-                            "--no-split" file "-o" output))
-        (message "Failed to build manual %s, see buffer %S"
-                 file (buffer-name)))
-       ((/= 0 (call-process "install-info" nil t nil
-                            output (expand-file-name "dir")))
-        (message "Failed to install manual %s, see buffer %S"
-                 output (buffer-name)))
-       ((kill-buffer))))
-    (when clean-up
-      (delete-file file))))
+    (if (not (file-exists-p file-name))
+        (message "Documentation file %S for %s not found" file pkg-name)
+      (when (string-match-p "\\.org\\'" file)
+        (require 'ox)
+        (require 'ox-texinfo)
+        (with-temp-buffer
+          (insert-file-contents file-name)
+          (setq file (make-temp-file "ox-texinfo-"))
+          (org-export-to-file 'texinfo file)
+          (setq clean-up t)))
+      (with-current-buffer (get-buffer-create " *package-vc doc*")
+        (erase-buffer)
+        (cond
+         ((/= 0 (call-process "makeinfo" nil t nil
+                              "--no-split" file "-o" output))
+          (message "Failed to build manual %s, see buffer %S"
+                   file (buffer-name)))
+         ((/= 0 (call-process "install-info" nil t nil
+                              output (expand-file-name "dir")))
+          (message "Failed to install manual %s, see buffer %S"
+                   output (buffer-name)))
+         ((kill-buffer))))
+      (when clean-up
+        (delete-file file)))))
 
 (defun package-vc-install-dependencies (requirements)
   "Install missing dependencies, and return missing ones.

[-- Attachment #3: Type: text/plain, Size: 11 bytes --]



> Joseph

^ permalink raw reply related	[relevance 5%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-11  2:04  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-12  6:51  5%                       ` Philip Kaludercic
@ 2023-05-12  6:56  5%                       ` Philip Kaludercic
  2023-05-13  5:47  5%                         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-05-12  6:56 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63337, Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 683 bytes --]

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Ok, do you have a few example repositories that we can use to test edge-cases?
>
> I first noticed this issue when attempting to build the docs for
> org-transclusion. Besides that, we could select a few package specs
> containing :make at random from
> https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/elpa-packages ?

Oh, and a big problem is that the "dir" file is written into the wrong
directory.  It has to be located in the root directory of the package,
not in docs/ (in the case of org-transclusion).  Sadly adjusting the
second argument doesn't fix the issue:


[-- Attachment #2: Type: text/plain, Size: 704 bytes --]

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index e9794eac783..9876705e57f 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -369,7 +369,8 @@ package-vc--build-documentation
         (message "Failed to build manual %s, see buffer %S"
                  file (buffer-name)))
        ((/= 0 (call-process "install-info" nil t nil
-                            output (expand-file-name "dir")))
+                            output
+                            (expand-file-name "dir" (package-desc-dir pkg-desc))))
         (message "Failed to install manual %s, see buffer %S"
                  output (buffer-name)))
        ((kill-buffer))))

[-- Attachment #3: Type: text/plain, Size: 177 bytes --]


While the entry does appear in (dir) Top, the file cannot be opened:

  Info-find-file: Info file ‘org-transclusion’ does not exist; consider installing it

> Joseph

^ permalink raw reply related	[relevance 5%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-12  6:56  5%                       ` Philip Kaludercic
@ 2023-05-13  5:47  5%                         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-13  5:47 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63337, Eli Zaretskii


Philip Kaludercic <philipk@posteo.net> writes:

> Oh, and a big problem is that the "dir" file is written into the wrong
> directory.  It has to be located in the root directory of the package,
> not in docs/ (in the case of org-transclusion).  Sadly adjusting the
> second argument doesn't fix the issue:
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index e9794eac783..9876705e57f 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -369,7 +369,8 @@ package-vc--build-documentation
>          (message "Failed to build manual %s, see buffer %S"
>                   file (buffer-name)))
>         ((/= 0 (call-process "install-info" nil t nil
> -                            output (expand-file-name "dir")))
> +                            output
> +                            (expand-file-name "dir" (package-desc-dir pkg-desc))))
>          (message "Failed to install manual %s, see buffer %S"
>                   output (buffer-name)))
>         ((kill-buffer))))
>
>
> While the entry does appear in (dir) Top, the file cannot be opened:
>
>   Info-find-file: Info file ‘org-transclusion’ does not exist; consider installing it

IIUC, you're saying that default-directory needs to be (package-desc-dir pkg-desc) when
install-info runs, right? Perhaps we should revisit the first patch I sent:

- leave default-directory as-is
- pass "-I docs-directory" to makeinfo

If makeinfo starts including more directory besides the working
directory in the future, I think it will still make sense to append the
docs-directory to the search path.





^ permalink raw reply	[relevance 5%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  @ 2023-05-13  5:54  5%                             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-13  5:54 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63337, Eli Zaretskii


Philip Kaludercic <philipk@posteo.net> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Philip Kaludercic <philipk@posteo.net>
>>> Cc: Eli Zaretskii <eliz@gnu.org>,  63337@debbugs.gnu.org
>>> Date: Fri, 12 May 2023 06:51:19 +0000
>>>
>>> One issue I still notice in this case is that if the file doesn't exist,
>>> the issue is raised by `insert-file-contents' which aborts the entire
>>> installation.  Does checking the existence of the file, and continuing
>>> on if this is not the case make sense:
>>
>> If the file's (non)existence is the problem, then checking that up
>> front is an okay solution, IMO.  Are there any downsides to doing that?
>
> One might not notice that there was an issue with the package
> specification, since a number of messages are usually generated when
> installing a package.  But I agree that this sounds better than not
> being able to install the package at all (as is currently the case with
> org-transclusion).

This change makes sense to me also. Would it be appropriate to use warn
instead of message? I'm not sure the convention here.

This change belongs in a separate commit, right?





^ permalink raw reply	[relevance 5%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-07 18:40 10%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-07 19:11  0%     ` Eli Zaretskii
@ 2023-05-13  8:41  5%     ` Philip Kaludercic
  2023-05-13 16:38 10%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-05-13  8:41 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63337

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>
>>> Hello!
>>>
>>> Because package-vc--build-documentation exports the texinfo manual to a
>>> temp file inside /tmp/ , any @include statements with relative paths
>>> break the makeinfo call.
>>>
>>> I noticed this issue when attempting to use package-vc to install
>>> org-transclusion, whose manual contains the line
>>>
>>> #+texinfo: @include fdl.texi
>>>
>>> See: https://raw.githubusercontent.com/nobiot/org-transclusion/main/docs/org-transclusion-manual.org
>>>
>>> The attached patch solves this problem by passing the -I flag to
>>> makeinfo. From makeinfo --help:
>>>
>>> -I DIR                        append DIR to the @include search path.
>>
>> Good catch, this should be applied to emacs-29.
>>
>>> Best,
>>>
>>> Joseph
>>>
>>> From a41abce88ed3b833c5531208945474c9cd16284b Mon Sep 17 00:00:00 2001
>>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>>> Date: Sat, 6 May 2023 14:49:43 -0700
>>> Subject: [PATCH] Fix: (package-vc--build-documentation) Relative @include
>>>  statements
>>>
>>> ---
>>>  lisp/emacs-lisp/package-vc.el | 5 ++++-
>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>>> index 489610e2a1e..63c10285ca7 100644
>>> --- a/lisp/emacs-lisp/package-vc.el
>>> +++ b/lisp/emacs-lisp/package-vc.el
>>> @@ -381,6 +381,7 @@ FILE can be an Org file, indicated by its \".org\" extension,
>>>  otherwise it's assumed to be an Info file."
>>>    (let* ((pkg-name (package-desc-name pkg-desc))
>>>           (default-directory (package-desc-dir pkg-desc))
>>> +         (docs-directory (expand-file-name (file-name-directory file)))
>>>           (output (expand-file-name (format "%s.info" pkg-name)))
>>>           clean-up)
>>>      (when (string-match-p "\\.org\\'" file)
>>> @@ -395,7 +396,9 @@ otherwise it's assumed to be an Info file."
>>>        (erase-buffer)
>>>        (cond
>>>         ((/= 0 (call-process "makeinfo" nil t nil
>>> -                            "--no-split" file "-o" output))
>>> +                            "-I" docs-directory
>>
>> According to the docs, makeinfo has -I to append the search path, and -P
>> to prepend.  I don't know how well either of the two are supported, but
>> assuming they are, shouldn't -P be preferred?  Or wouldn't it have any
>> effect?
>
> I am not sure what difference it would make. I don't know if the default
> @include search path includes anything besides the working directory.
>
> In the attached diff, I have changed -I to -P.

I can confirm that this patch does the right thing, and I think we
should apply it.

>>> +                            "--no-split" file
>>> +                            "-o" output))
>>>          (message "Failed to build manual %s, see buffer %S"
>>>                   file (buffer-name)))
>>>         ((/= 0 (call-process "install-info" nil t nil






^ permalink raw reply	[relevance 5%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-13  8:41  5%     ` Philip Kaludercic
@ 2023-05-13 16:38 10%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-13 17:14  5%         ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-13 16:38 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63337

[-- Attachment #1: Type: text/plain, Size: 1543 bytes --]


Philip Kaludercic <philipk@posteo.net> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Philip Kaludercic <philipk@posteo.net> writes:
>>
>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>>
>>>> Hello!
>>>>
>>>> Because package-vc--build-documentation exports the texinfo manual to a
>>>> temp file inside /tmp/ , any @include statements with relative paths
>>>> break the makeinfo call.
>>>>
>>>> I noticed this issue when attempting to use package-vc to install
>>>> org-transclusion, whose manual contains the line
>>>>
>>>> #+texinfo: @include fdl.texi
>>>>
>>>> See: https://raw.githubusercontent.com/nobiot/org-transclusion/main/docs/org-transclusion-manual.org
>>>>
>>>> The attached patch solves this problem by passing the -I flag to
>>>> makeinfo. From makeinfo --help:
>>>>
>>>> -I DIR                        append DIR to the @include search path.

>>> According to the docs, makeinfo has -I to append the search path, and -P
>>> to prepend.  I don't know how well either of the two are supported, but
>>> assuming they are, shouldn't -P be preferred?  Or wouldn't it have any
>>> effect?
>>
>> I am not sure what difference it would make. I don't know if the default
>> @include search path includes anything besides the working directory.
>>
>> In the attached diff, I have changed -I to -P.
>
> I can confirm that this patch does the right thing, and I think we
> should apply it.

I think Eli suggested we prepend (-I) instead of append (-P), as in the
very first patch I sent, also attached here.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-package-vc-build-documentation-Relative-include-.patch --]
[-- Type: text/x-diff, Size: 1478 bytes --]

From a41abce88ed3b833c5531208945474c9cd16284b Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 6 May 2023 14:49:43 -0700
Subject: [PATCH] Fix: (package-vc--build-documentation) Relative @include
 statements

---
 lisp/emacs-lisp/package-vc.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 489610e2a1e..63c10285ca7 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -381,6 +381,7 @@ FILE can be an Org file, indicated by its \".org\" extension,
 otherwise it's assumed to be an Info file."
   (let* ((pkg-name (package-desc-name pkg-desc))
          (default-directory (package-desc-dir pkg-desc))
+         (docs-directory (expand-file-name (file-name-directory file)))
          (output (expand-file-name (format "%s.info" pkg-name)))
          clean-up)
     (when (string-match-p "\\.org\\'" file)
@@ -395,7 +396,9 @@ otherwise it's assumed to be an Info file."
       (erase-buffer)
       (cond
        ((/= 0 (call-process "makeinfo" nil t nil
-                            "--no-split" file "-o" output))
+                            "-I" docs-directory
+                            "--no-split" file
+                            "-o" output))
         (message "Failed to build manual %s, see buffer %S"
                  file (buffer-name)))
        ((/= 0 (call-process "install-info" nil t nil
-- 
2.39.2


^ permalink raw reply related	[relevance 10%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-13 16:38 10%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-13 17:14  5%         ` Philip Kaludercic
  2023-05-13 18:31  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-05-13 17:14 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63337

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>
>>> Philip Kaludercic <philipk@posteo.net> writes:
>>>
>>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>>>
>>>>> Hello!
>>>>>
>>>>> Because package-vc--build-documentation exports the texinfo manual to a
>>>>> temp file inside /tmp/ , any @include statements with relative paths
>>>>> break the makeinfo call.
>>>>>
>>>>> I noticed this issue when attempting to use package-vc to install
>>>>> org-transclusion, whose manual contains the line
>>>>>
>>>>> #+texinfo: @include fdl.texi
>>>>>
>>>>> See: https://raw.githubusercontent.com/nobiot/org-transclusion/main/docs/org-transclusion-manual.org
>>>>>
>>>>> The attached patch solves this problem by passing the -I flag to
>>>>> makeinfo. From makeinfo --help:
>>>>>
>>>>> -I DIR                        append DIR to the @include search path.
>
>>>> According to the docs, makeinfo has -I to append the search path, and -P
>>>> to prepend.  I don't know how well either of the two are supported, but
>>>> assuming they are, shouldn't -P be preferred?  Or wouldn't it have any
>>>> effect?
>>>
>>> I am not sure what difference it would make. I don't know if the default
>>> @include search path includes anything besides the working directory.
>>>
>>> In the attached diff, I have changed -I to -P.
>>
>> I can confirm that this patch does the right thing, and I think we
>> should apply it.
>
> I think Eli suggested we prepend (-I) instead of append (-P), as in the
> very first patch I sent, also attached here.

I did not understand the argument, but it probably does not matter that
much.  As this patch has Eli's blessing, I will apply it.

> From a41abce88ed3b833c5531208945474c9cd16284b Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Sat, 6 May 2023 14:49:43 -0700
> Subject: [PATCH] Fix: (package-vc--build-documentation) Relative @include
>  statements
>
> ---
>  lisp/emacs-lisp/package-vc.el | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index 489610e2a1e..63c10285ca7 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -381,6 +381,7 @@ FILE can be an Org file, indicated by its \".org\" extension,
>  otherwise it's assumed to be an Info file."
>    (let* ((pkg-name (package-desc-name pkg-desc))
>           (default-directory (package-desc-dir pkg-desc))
> +         (docs-directory (expand-file-name (file-name-directory file)))
>           (output (expand-file-name (format "%s.info" pkg-name)))
>           clean-up)
>      (when (string-match-p "\\.org\\'" file)
> @@ -395,7 +396,9 @@ otherwise it's assumed to be an Info file."
>        (erase-buffer)
>        (cond
>         ((/= 0 (call-process "makeinfo" nil t nil
> -                            "--no-split" file "-o" output))
> +                            "-I" docs-directory
> +                            "--no-split" file
> +                            "-o" output))
>          (message "Failed to build manual %s, see buffer %S"
>                   file (buffer-name)))
>         ((/= 0 (call-process "install-info" nil t nil





^ permalink raw reply	[relevance 5%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-10  6:35  5%     ` Philip Kaludercic
  2023-05-11  1:37  9%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-13 17:18  0%       ` Philip Kaludercic
  1 sibling, 0 replies; 200+ results
From: Philip Kaludercic @ 2023-05-13 17:18 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63336

ping?

Philip Kaludercic <philipk@posteo.net> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>>>> +(defun package-vc--make (pkg-spec dir)
>>>> +  "Process :make and :shell-command spec arguments."
>>>> +  (let ((target (plist-get pkg-spec :make))
>>>> +        (cmd (plist-get pkg-spec :shell-command)))
>>>> +    (when (or cmd target)
>>>> +      (with-current-buffer (get-buffer-create " *package-vc make*")
>>>                                                  ^
>>>                                                  should the package name
>>>                                                  be mentioned here?
>>
>> I like this idea, but IIUC package-vc--make would then need to take an
>> extra arg, since pkg-spec doesn't contain the :name of the package. We
>> could also add :name to the pkg-spec plist?
>
> I wouldn't be in favour of that, I think that passing the name as a
> separate argument would be a better solution.
>
>> For comparison, package-vc--build-documentation creates a buffer called
>> " *package-vc doc*" without the package name.
>
> The difference I see here is that documentation usually builds fine,
> while :make or :shell-command have a higher chance of failing because
> some software is missing, especially if people don't use :make the way
> it is used on the ELPA server but to build external dependencies (I'm
> thinking of mail clients like notmuch)
>
>>>> +                   target (buffer-name)))))))
>>>> +
>>>>  (declare-function org-export-to-file "ox" (backend file))
>>>>
>>>>  (defun package-vc--build-documentation (pkg-desc file)
>>>> @@ -486,6 +515,9 @@ documentation and marking the package as installed."
>>>>        ;; Generate package file
>>>>        (package-vc--generate-description-file pkg-desc pkg-file)
>>>>
>>>> +      ;; Process :make and :shell-command arguments before building documentation
>>>> +      (when package-vc-process-make (package-vc--make pkg-spec pkg-dir))
>>>
>>> Wasn't the plan to allow `package-vc-process-make' to either be a
>>> generic "build-anything" or a selective listing of packages where we
>>> allow :make and :shell-command to be executed?
>>
>> Let me know if the attached commit accomplishes what you had in mind.
>
> Yes, that (or rather the newest version from a different message) looks good.
>
>>>> +
>>>>        ;; Detect a manual
>>>>        (when (executable-find "install-info")
>>>>          (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
>>>
>>> Otherwise this looks good, but I haven't tried it out yet.
>>
>> I fixed up a couple other issues:
>>
>> - removed unnecessary dir arg to package-vc--make
>> - added function arg to the docstring for package-vc--make
>>
>> I'm not sure if the customization type for package-vc-process-make is
>> correct. Please double check that.
>>
>> Also, should users be able to run :make and :shell-command args defined
>> in a spec passed into package-vc-install?
>
> Yes, is that currently not supported?
>
>> Best,
>>
>> Joseph





^ permalink raw reply	[relevance 0%]

* bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements
  2023-05-13 17:14  5%         ` Philip Kaludercic
@ 2023-05-13 18:31  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-13 18:31 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63337


Philip Kaludercic <philipk@posteo.net> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Philip Kaludercic <philipk@posteo.net> writes:
>>
>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>>
>>>> Philip Kaludercic <philipk@posteo.net> writes:
>>>>
>>>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>>>>
>>>>>> Hello!
>>>>>>
>>>>>> Because package-vc--build-documentation exports the texinfo manual to a
>>>>>> temp file inside /tmp/ , any @include statements with relative paths
>>>>>> break the makeinfo call.
>>>>>>
>>>>>> I noticed this issue when attempting to use package-vc to install
>>>>>> org-transclusion, whose manual contains the line
>>>>>>
>>>>>> #+texinfo: @include fdl.texi
>>>>>>
>>>>>> See: https://raw.githubusercontent.com/nobiot/org-transclusion/main/docs/org-transclusion-manual.org
>>>>>>
>>>>>> The attached patch solves this problem by passing the -I flag to
>>>>>> makeinfo. From makeinfo --help:
>>>>>>
>>>>>> -I DIR                        append DIR to the @include search path.
>>
>>>>> According to the docs, makeinfo has -I to append the search path, and -P
>>>>> to prepend.  I don't know how well either of the two are supported, but
>>>>> assuming they are, shouldn't -P be preferred?  Or wouldn't it have any
>>>>> effect?
>>>>
>>>> I am not sure what difference it would make. I don't know if the default
>>>> @include search path includes anything besides the working directory.
>>>>
>>>> In the attached diff, I have changed -I to -P.
>>>
>>> I can confirm that this patch does the right thing, and I think we
>>> should apply it.
>>
>> I think Eli suggested we prepend (-I) instead of append (-P), as in the
>> very first patch I sent, also attached here.
>
> I did not understand the argument, but it probably does not matter that
> much.  As this patch has Eli's blessing, I will apply it.

Great! Thank you!!

>
>> From a41abce88ed3b833c5531208945474c9cd16284b Mon Sep 17 00:00:00 2001
>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Date: Sat, 6 May 2023 14:49:43 -0700
>> Subject: [PATCH] Fix: (package-vc--build-documentation) Relative @include
>>  statements
>>
>> ---
>>  lisp/emacs-lisp/package-vc.el | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>> index 489610e2a1e..63c10285ca7 100644
>> --- a/lisp/emacs-lisp/package-vc.el
>> +++ b/lisp/emacs-lisp/package-vc.el
>> @@ -381,6 +381,7 @@ FILE can be an Org file, indicated by its \".org\" extension,
>>  otherwise it's assumed to be an Info file."
>>    (let* ((pkg-name (package-desc-name pkg-desc))
>>           (default-directory (package-desc-dir pkg-desc))
>> +         (docs-directory (expand-file-name (file-name-directory file)))
>>           (output (expand-file-name (format "%s.info" pkg-name)))
>>           clean-up)
>>      (when (string-match-p "\\.org\\'" file)
>> @@ -395,7 +396,9 @@ otherwise it's assumed to be an Info file."
>>        (erase-buffer)
>>        (cond
>>         ((/= 0 (call-process "makeinfo" nil t nil
>> -                            "--no-split" file "-o" output))
>> +                            "-I" docs-directory
>> +                            "--no-split" file
>> +                            "-o" output))
>>          (message "Failed to build manual %s, see buffer %S"
>>                   file (buffer-name)))
>>         ((/= 0 (call-process "install-info" nil t nil






^ permalink raw reply	[relevance 5%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-11  1:37  9%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-14  7:44  5%         ` Philip Kaludercic
  2023-05-14  8:08  8%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-05-14  7:44 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63336

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>
>>>>> +(defun package-vc--make (pkg-spec dir)
>>>>> +  "Process :make and :shell-command spec arguments."
>>>>> +  (let ((target (plist-get pkg-spec :make))
>>>>> +        (cmd (plist-get pkg-spec :shell-command)))
>>>>> +    (when (or cmd target)
>>>>> +      (with-current-buffer (get-buffer-create " *package-vc make*")
>>>>                                                  ^
>>>>                                                  should the package name
>>>>                                                  be mentioned here?
>>>
>>> I like this idea, but IIUC package-vc--make would then need to take an
>>> extra arg, since pkg-spec doesn't contain the :name of the package. We
>>> could also add :name to the pkg-spec plist?
>>
>> I wouldn't be in favour of that, I think that passing the name as a
>> separate argument would be a better solution.
>
> I agree.
>
>>> For comparison, package-vc--build-documentation creates a buffer called
>>> " *package-vc doc*" without the package name.
>>
>> The difference I see here is that documentation usually builds fine,
>> while :make or :shell-command have a higher chance of failing because
>> some software is missing, especially if people don't use :make the way
>> it is used on the ELPA server but to build external dependencies (I'm
>> thinking of mail clients like notmuch)
>
> That makes sense to me. In the attached patch, I pass pkg-desc to
> package-vc--make instead just name.
>
> Want me to submit a separate patch which adds the package name to the
> " *package-vc doc*" buffer name?

No, I don't think it is necessary.  But thanks.

>>>>> +                   target (buffer-name)))))))
>>>>> +
>>>>>  (declare-function org-export-to-file "ox" (backend file))
>>>>>
>>>>>  (defun package-vc--build-documentation (pkg-desc file)
>>>>> @@ -486,6 +515,9 @@ documentation and marking the package as installed."
>>>>>        ;; Generate package file
>>>>>        (package-vc--generate-description-file pkg-desc pkg-file)
>>>>>
>>>>> +      ;; Process :make and :shell-command arguments before building documentation
>>>>> +      (when package-vc-process-make (package-vc--make pkg-spec pkg-dir))
>>>>
>>>> Wasn't the plan to allow `package-vc-process-make' to either be a
>>>> generic "build-anything" or a selective listing of packages where we
>>>> allow :make and :shell-command to be executed?
>>>
>>> Let me know if the attached commit accomplishes what you had in mind.
>>
>> Yes, that (or rather the newest version from a different message) looks good.
>>
>>>>> +
>>>>>        ;; Detect a manual
>>>>>        (when (executable-find "install-info")
>>>>>          (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
>>>>
>>>> Otherwise this looks good, but I haven't tried it out yet.
>>>
>>> I fixed up a couple other issues:
>>>
>>> - removed unnecessary dir arg to package-vc--make
>>> - added function arg to the docstring for package-vc--make
>>>
>>> I'm not sure if the customization type for package-vc-process-make is
>>> correct. Please double check that.
>>>
>>> Also, should users be able to run :make and :shell-command args defined
>>> in a spec passed into package-vc-install?
>>
>> Yes, is that currently not supported?
>
> Nevermind! It is supported. I didn't notice that package-vc--unpack adds
> the user-defined pkg-spec to package-vc-selected-packages just before
> calling package-vc--unpack-1.

1+

> Best,
>
> Joseph
>
> From b27724197acd4ee72f9d336843f0e6ed9fcee87b Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Sat, 13 May 2023 10:05:04 -0700
> Subject: [PATCH] package-vc: Process :make and :shell-command spec args
>
> ---
>  lisp/emacs-lisp/package-vc.el | 37 +++++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index beca0bd00e2..8529d1dad5c 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -344,6 +344,33 @@ asynchronously."
>          "\n")
>         nil pkg-file nil 'silent))))
>  
> +(defcustom package-vc-process-make nil

Have we discussed the name of this user option?  I feel it is too
immediate, and therefore not intuitively obvious what purpose it serves.
I would imagine something along the lines of
"package-vc-allow-side-effects" or "package-vc-permit-building" could be
better?  WDYT?

> +  "Whether to process :make and :shell-command spec arguments.

I guess here too an explanation would be warranted (and in the manual).
Explaining what the issue is, and why one might be wary to enable the option.

> +When set to a list of symbols (packages), run commands for only
> +packages in the list. When `nil', never run commands. Otherwise
> +when non-`nil', run commands for any package with :make or
> +:shell-command specified.
> +
> +Package specs are loaded from trusted package archives."
> +  :type '(choice (const :tag "Run for all packages" t)
> +                 (repeat :tag "Run only for selected packages" (symbol :tag "Package name"))
> +                 (const :tag "Never run" nil))
> +  :version "30.1")
> +
> +(defun package-vc--make (pkg-spec pkg-desc)
> +  "Process :make and :shell-command PKG-SPEC arguments for PKG-DESC."
> +  (let ((target (plist-get pkg-spec :make))
> +        (cmd (plist-get pkg-spec :shell-command)))
> +    (when (or cmd target)
> +      (with-current-buffer (get-buffer-create

I'd format the buffer name in the top let to prevent this line-break here.

> +                            (format " *package-vc make %s*" (package-desc-name pkg-desc)))
> +        (erase-buffer)
> +        (when (and cmd (/= 0 (call-process shell-file-name nil t nil shell-command-switch cmd)))
> +          (warn "Failed to run %s, see buffer %S" cmd (buffer-name)))
> +        (when (and target (/= 0 (apply #'call-process "make" nil t nil (if (consp target) target (list target)))))
> +          (warn "Failed to make %s, see buffer %S" target (buffer-name)))))))

If :shell-command fails, do we really want to proceed to :make?

>  (declare-function org-export-to-file "ox" (backend file))
>  
>  (defun package-vc--build-documentation (pkg-desc file)
> @@ -486,6 +513,16 @@ documentation and marking the package as installed."
>        ;; Generate package file
>        (package-vc--generate-description-file pkg-desc pkg-file)
>  
> +      ;; Process :make and :shell-command arguments before building documentation
> +      (pcase package-vc-process-make
> +        ((pred consp) ; When non-`nil' list, check if package is on the list.
> +         (when (memq (package-desc-name pkg-desc) package-vc-process-make)
> +           (package-vc--make pkg-spec pkg-desc)))
> +        ('nil         ; When `nil', do nothing.
> +         nil)

Perhaps swap the two conditions, first checking nil then listp which I
think reads more natural.  Then again, is pcase actually serving
anything here?

> +        (_            ; When otherwise non-`nil', run commands.
> +         (package-vc--make pkg-spec pkg-desc)))
> +
>        ;; Detect a manual
>        (when (executable-find "install-info")
>          (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))





^ permalink raw reply	[relevance 5%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-14  7:44  5%         ` Philip Kaludercic
@ 2023-05-14  8:08  8%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-14 19:30  5%             ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-14  8:08 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63336

[-- Attachment #1: Type: text/plain, Size: 4703 bytes --]


Philip Kaludercic <philipk@posteo.net> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Philip Kaludercic <philipk@posteo.net> writes:
>>
>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>> From b27724197acd4ee72f9d336843f0e6ed9fcee87b Mon Sep 17 00:00:00 2001
>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Date: Sat, 13 May 2023 10:05:04 -0700
>> Subject: [PATCH] package-vc: Process :make and :shell-command spec args
>>
>> ---
>>  lisp/emacs-lisp/package-vc.el | 37 +++++++++++++++++++++++++++++++++++
>>  1 file changed, 37 insertions(+)
>>
>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>> index beca0bd00e2..8529d1dad5c 100644
>> --- a/lisp/emacs-lisp/package-vc.el
>> +++ b/lisp/emacs-lisp/package-vc.el
>> @@ -344,6 +344,33 @@ asynchronously."
>>          "\n")
>>         nil pkg-file nil 'silent))))
>>
>> +(defcustom package-vc-process-make nil
>
> Have we discussed the name of this user option?  I feel it is too
> immediate, and therefore not intuitively obvious what purpose it serves.
> I would imagine something along the lines of
> "package-vc-allow-side-effects" or "package-vc-permit-building" could be
> better?  WDYT?

I like "package-vc-allow-side-effects". Changed in attached patch.

>> +  "Whether to process :make and :shell-command spec arguments.
>
> I guess here too an explanation would be warranted (and in the manual).
> Explaining what the issue is, and why one might be wary to enable the option.

Does my addition suffice?

We also might want to add another option for
package-vc-allow-side-effects like 'user-defined, which only runs :make
and :shell-command args which were specified by the user (as opposed to
those which were downloaded from elpa). WDYT?

To update the manual, shall I edit doc/emacs/package.texi directly or is
there another file to edit?

>> +When set to a list of symbols (packages), run commands for only
>> +packages in the list. When `nil', never run commands. Otherwise
>> +when non-`nil', run commands for any package with :make or
>> +:shell-command specified.
>> +
>> +Package specs are loaded from trusted package archives."
>> +  :type '(choice (const :tag "Run for all packages" t)
>> +                 (repeat :tag "Run only for selected packages" (symbol :tag "Package name"))
>> +                 (const :tag "Never run" nil))
>> +  :version "30.1")
>> +
>> +(defun package-vc--make (pkg-spec pkg-desc)
>> +  "Process :make and :shell-command PKG-SPEC arguments for PKG-DESC."
>> +  (let ((target (plist-get pkg-spec :make))
>> +        (cmd (plist-get pkg-spec :shell-command)))
>> +    (when (or cmd target)
>> +      (with-current-buffer (get-buffer-create
>
> I'd format the buffer name in the top let to prevent this line-break here.

Done.

>> +                            (format " *package-vc make %s*" (package-desc-name pkg-desc)))
>> +        (erase-buffer)
>> +        (when (and cmd (/= 0 (call-process shell-file-name nil t nil shell-command-switch cmd)))
>> +          (warn "Failed to run %s, see buffer %S" cmd (buffer-name)))
>> +        (when (and target (/= 0 (apply #'call-process "make" nil t nil (if (consp target) target (list target)))))
>> +          (warn "Failed to make %s, see buffer %S" target (buffer-name)))))))
>
> If :shell-command fails, do we really want to proceed to :make?

Up to you! I was following the lead of elpa-admin.el.

>>  (declare-function org-export-to-file "ox" (backend file))
>>
>>  (defun package-vc--build-documentation (pkg-desc file)
>> @@ -486,6 +513,16 @@ documentation and marking the package as installed."
>>        ;; Generate package file
>>        (package-vc--generate-description-file pkg-desc pkg-file)
>>
>> +      ;; Process :make and :shell-command arguments before building documentation
>> +      (pcase package-vc-process-make
>> +        ((pred consp) ; When non-`nil' list, check if package is on the list.
>> +         (when (memq (package-desc-name pkg-desc) package-vc-process-make)
>> +           (package-vc--make pkg-spec pkg-desc)))
>> +        ('nil         ; When `nil', do nothing.
>> +         nil)
>
> Perhaps swap the two conditions, first checking nil then listp which I
> think reads more natural.  Then again, is pcase actually serving
> anything here?

I switched the first two cases. I think pcase is readable here,
especially if we add an 'user-defined option. What would you use
instead?

>> +        (_            ; When otherwise non-`nil', run commands.
>> +         (package-vc--make pkg-spec pkg-desc)))
>> +
>>        ;; Detect a manual
>>        (when (executable-find "install-info")
>>          (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-package-vc-Process-make-and-shell-command-spec-args.patch --]
[-- Type: text/x-diff, Size: 3065 bytes --]

From 3e7084e8e3e3ba142f383e90bfa656f59f3cc1ad Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 13 May 2023 10:05:04 -0700
Subject: [PATCH] package-vc: Process :make and :shell-command spec args

---
 lisp/emacs-lisp/package-vc.el | 40 +++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index beca0bd00e2..8403add364c 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -344,6 +344,36 @@ asynchronously."
         "\n")
        nil pkg-file nil 'silent))))
 
+(defcustom package-vc-allow-side-effects nil
+  "Whether to process :make and :shell-command spec arguments.
+
+Be careful when changing this option as processing :make and
+:shell-command will run potentially harmful code.
+
+When set to a list of symbols (packages), run commands for only
+packages in the list. When `nil', never run commands.  Otherwise
+when non-`nil', run commands for any package with :make or
+:shell-command specified.
+
+Package specs are loaded from trusted package archives."
+  :type '(choice (const :tag "Run for all packages" t)
+                 (repeat :tag "Run only for selected packages" (symbol :tag "Package name"))
+                 (const :tag "Never run" nil))
+  :version "30.1")
+
+(defun package-vc--make (pkg-spec pkg-desc)
+  "Process :make and :shell-command PKG-SPEC arguments for PKG-DESC."
+  (let ((target (plist-get pkg-spec :make))
+        (cmd (plist-get pkg-spec :shell-command))
+        (buf (format " *package-vc make %s*" (package-desc-name pkg-desc))))
+    (when (or cmd target)
+      (with-current-buffer (get-buffer-create buf)
+        (erase-buffer)
+        (when (and cmd (/= 0 (call-process shell-file-name nil t nil shell-command-switch cmd)))
+          (warn "Failed to run %s, see buffer %S" cmd (buffer-name)))
+        (when (and target (/= 0 (apply #'call-process "make" nil t nil (if (consp target) target (list target)))))
+          (warn "Failed to make %s, see buffer %S" target (buffer-name)))))))
+
 (declare-function org-export-to-file "ox" (backend file))
 
 (defun package-vc--build-documentation (pkg-desc file)
@@ -486,6 +516,16 @@ documentation and marking the package as installed."
       ;; Generate package file
       (package-vc--generate-description-file pkg-desc pkg-file)
 
+      ;; Process :make and :shell-command arguments before building documentation
+      (pcase package-vc-allow-side-effects
+        ('nil         ; When `nil', do nothing.
+         nil)
+        ((pred consp) ; When non-`nil' list, check if package is on the list.
+         (when (memq (package-desc-name pkg-desc) package-vc-allow-side-effects)
+           (package-vc--make pkg-spec pkg-desc)))
+        (_            ; When otherwise non-`nil', run commands.
+         (package-vc--make pkg-spec pkg-desc)))
+
       ;; Detect a manual
       (when (executable-find "install-info")
         (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
-- 
2.40.1


^ permalink raw reply related	[relevance 8%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-14  8:08  8%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-14 19:30  5%             ` Philip Kaludercic
  2023-05-14 23:01  8%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-05-14 19:30 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63336

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>
>>> Philip Kaludercic <philipk@posteo.net> writes:
>>>
>>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>> From b27724197acd4ee72f9d336843f0e6ed9fcee87b Mon Sep 17 00:00:00 2001
>>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>>> Date: Sat, 13 May 2023 10:05:04 -0700
>>> Subject: [PATCH] package-vc: Process :make and :shell-command spec args
>>>
>>> ---
>>>  lisp/emacs-lisp/package-vc.el | 37 +++++++++++++++++++++++++++++++++++
>>>  1 file changed, 37 insertions(+)
>>>
>>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>>> index beca0bd00e2..8529d1dad5c 100644
>>> --- a/lisp/emacs-lisp/package-vc.el
>>> +++ b/lisp/emacs-lisp/package-vc.el
>>> @@ -344,6 +344,33 @@ asynchronously."
>>>          "\n")
>>>         nil pkg-file nil 'silent))))
>>>
>>> +(defcustom package-vc-process-make nil
>>
>> Have we discussed the name of this user option?  I feel it is too
>> immediate, and therefore not intuitively obvious what purpose it serves.
>> I would imagine something along the lines of
>> "package-vc-allow-side-effects" or "package-vc-permit-building" could be
>> better?  WDYT?
>
> I like "package-vc-allow-side-effects". Changed in attached patch.
>
>>> +  "Whether to process :make and :shell-command spec arguments.
>>
>> I guess here too an explanation would be warranted (and in the manual).
>> Explaining what the issue is, and why one might be wary to enable the option.
>
> Does my addition suffice?
>
> We also might want to add another option for
> package-vc-allow-side-effects like 'user-defined, which only runs :make
> and :shell-command args which were specified by the user (as opposed to
> those which were downloaded from elpa). WDYT?

That sounds like a good idea, but let us do that in a separate patch.

> To update the manual, shall I edit doc/emacs/package.texi directly or is
> there another file to edit?

Yes, just update the table under the "Specifying Package Sources" subsection.

>>> +When set to a list of symbols (packages), run commands for only
>>> +packages in the list. When `nil', never run commands. Otherwise
>>> +when non-`nil', run commands for any package with :make or
>>> +:shell-command specified.
>>> +
>>> +Package specs are loaded from trusted package archives."
>>> +  :type '(choice (const :tag "Run for all packages" t)
>>> +                 (repeat :tag "Run only for selected packages" (symbol :tag "Package name"))
>>> +                 (const :tag "Never run" nil))
>>> +  :version "30.1")
>>> +
>>> +(defun package-vc--make (pkg-spec pkg-desc)
>>> +  "Process :make and :shell-command PKG-SPEC arguments for PKG-DESC."
>>> +  (let ((target (plist-get pkg-spec :make))
>>> +        (cmd (plist-get pkg-spec :shell-command)))
>>> +    (when (or cmd target)
>>> +      (with-current-buffer (get-buffer-create
>>
>> I'd format the buffer name in the top let to prevent this line-break here.
>
> Done.
>
>>> +                            (format " *package-vc make %s*" (package-desc-name pkg-desc)))
>>> +        (erase-buffer)
>>> +        (when (and cmd (/= 0 (call-process shell-file-name nil t nil shell-command-switch cmd)))
>>> +          (warn "Failed to run %s, see buffer %S" cmd (buffer-name)))
>>> +        (when (and target (/= 0 (apply #'call-process "make" nil t nil (if (consp target) target (list target)))))
>>> +          (warn "Failed to make %s, see buffer %S" target (buffer-name)))))))
>>
>> If :shell-command fails, do we really want to proceed to :make?
>
> Up to you! I was following the lead of elpa-admin.el.

In that case let us do that too, unless there is a good reason not to.

>>>  (declare-function org-export-to-file "ox" (backend file))
>>>
>>>  (defun package-vc--build-documentation (pkg-desc file)
>>> @@ -486,6 +513,16 @@ documentation and marking the package as installed."
>>>        ;; Generate package file
>>>        (package-vc--generate-description-file pkg-desc pkg-file)
>>>
>>> +      ;; Process :make and :shell-command arguments before building documentation
>>> +      (pcase package-vc-process-make
>>> +        ((pred consp) ; When non-`nil' list, check if package is on the list.
>>> +         (when (memq (package-desc-name pkg-desc) package-vc-process-make)
>>> +           (package-vc--make pkg-spec pkg-desc)))
>>> +        ('nil         ; When `nil', do nothing.
>>> +         nil)
>>
>> Perhaps swap the two conditions, first checking nil then listp which I
>> think reads more natural.  Then again, is pcase actually serving
>> anything here?
>
> I switched the first two cases. I think pcase is readable here,
> especially if we add an 'user-defined option. What would you use
> instead?

I would have just used a regular cond.

--8<---------------cut here---------------start------------->8---
(cond
 ((null package-vc-process-make)
  ...)
 ((listp package-vc-process-make)
  ...)
 (...))
--8<---------------cut here---------------end--------------->8---

But this doesn't matter, do what you prefer.

>>> +        (_            ; When otherwise non-`nil', run commands.
>>> +         (package-vc--make pkg-spec pkg-desc)))
>>> +
>>>        ;; Detect a manual
>>>        (when (executable-find "install-info")
>>>          (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
>
> From 3e7084e8e3e3ba142f383e90bfa656f59f3cc1ad Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Sat, 13 May 2023 10:05:04 -0700
> Subject: [PATCH] package-vc: Process :make and :shell-command spec args
>
> ---
>  lisp/emacs-lisp/package-vc.el | 40 +++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index beca0bd00e2..8403add364c 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -344,6 +344,36 @@ asynchronously."
>          "\n")
>         nil pkg-file nil 'silent))))
>  
> +(defcustom package-vc-allow-side-effects nil
> +  "Whether to process :make and :shell-command spec arguments.
> +
> +Be careful when changing this option as processing :make and
> +:shell-command will run potentially harmful code.

Sounds scary.  I guess that is the point, but what do you think about
something like

  Be careful when changing this option, as installing and updating a
  package can potentially run harmful code.  If possible, allow packages
  you trust to run code, if it is necessary for a package to be properly
  initialised.

> +
> +When set to a list of symbols (packages), run commands for only
> +packages in the list. When `nil', never run commands.  Otherwise
> +when non-`nil', run commands for any package with :make or
> +:shell-command specified.

Watch out.  According to (elisp) Documentation Tips, nil is not quoted.

> +
> +Package specs are loaded from trusted package archives."
> +  :type '(choice (const :tag "Run for all packages" t)
> +                 (repeat :tag "Run only for selected packages" (symbol :tag "Package name"))
> +                 (const :tag "Never run" nil))
> +  :version "30.1")
> +
> +(defun package-vc--make (pkg-spec pkg-desc)
> +  "Process :make and :shell-command PKG-SPEC arguments for PKG-DESC."
> +  (let ((target (plist-get pkg-spec :make))
> +        (cmd (plist-get pkg-spec :shell-command))
> +        (buf (format " *package-vc make %s*" (package-desc-name pkg-desc))))
> +    (when (or cmd target)
> +      (with-current-buffer (get-buffer-create buf)
> +        (erase-buffer)
> +        (when (and cmd (/= 0 (call-process shell-file-name nil t nil shell-command-switch cmd)))
> +          (warn "Failed to run %s, see buffer %S" cmd (buffer-name)))
> +        (when (and target (/= 0 (apply #'call-process "make" nil t nil (if (consp target) target (list target)))))
> +          (warn "Failed to make %s, see buffer %S" target (buffer-name)))))))
> +
>  (declare-function org-export-to-file "ox" (backend file))
>  
>  (defun package-vc--build-documentation (pkg-desc file)
> @@ -486,6 +516,16 @@ documentation and marking the package as installed."
>        ;; Generate package file
>        (package-vc--generate-description-file pkg-desc pkg-file)
>  
> +      ;; Process :make and :shell-command arguments before building documentation
> +      (pcase package-vc-allow-side-effects
> +        ('nil         ; When `nil', do nothing.
> +         nil)
> +        ((pred consp) ; When non-`nil' list, check if package is on the list.
> +         (when (memq (package-desc-name pkg-desc) package-vc-allow-side-effects)
> +           (package-vc--make pkg-spec pkg-desc)))
> +        (_            ; When otherwise non-`nil', run commands.
> +         (package-vc--make pkg-spec pkg-desc)))
> +
>        ;; Detect a manual
>        (when (executable-find "install-info")
>          (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))





^ permalink raw reply	[relevance 5%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-14 19:30  5%             ` Philip Kaludercic
@ 2023-05-14 23:01  8%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-15  9:12  5%                 ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-14 23:01 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63336

[-- Attachment #1: Type: text/plain, Size: 2440 bytes --]


Philip Kaludercic <philipk@posteo.net> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Philip Kaludercic <philipk@posteo.net> writes:
>>
>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>>
>>>> Philip Kaludercic <philipk@posteo.net> writes:
>>>>
>>>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:

>> We also might want to add another option for
>> package-vc-allow-side-effects like 'user-defined, which only runs :make
>> and :shell-command args which were specified by the user (as opposed to
>> those which were downloaded from elpa). WDYT?
>
> That sounds like a good idea, but let us do that in a separate patch.

Okay!

>> To update the manual, shall I edit doc/emacs/package.texi directly or is
>> there another file to edit?
>
> Yes, just update the table under the "Specifying Package Sources" subsection.

See patch.

>>> If :shell-command fails, do we really want to proceed to :make?
>>
>> Up to you! I was following the lead of elpa-admin.el.
>
> In that case let us do that too, unless there is a good reason not to.

+1

>> I switched the first two cases. I think pcase is readable here,
>> especially if we add an 'user-defined option. What would you use
>> instead?
>
> I would have just used a regular cond.
>
> --8<---------------cut here---------------start------------->8---
> (cond
>  ((null package-vc-process-make)
>   ...)
>  ((listp package-vc-process-make)
>   ...)
>  (...))
> --8<---------------cut here---------------end--------------->8---
>
> But this doesn't matter, do what you prefer.

Thank you! I like pcase here.

>> +Be careful when changing this option as processing :make and
>> +:shell-command will run potentially harmful code.
>
> Sounds scary.  I guess that is the point, but what do you think about
> something like
>
>   Be careful when changing this option, as installing and updating a
>   package can potentially run harmful code.  If possible, allow packages
>   you trust to run code, if it is necessary for a package to be properly
>   initialised.

Thank you! What do you think about the version in the attached patch?

>> +When set to a list of symbols (packages), run commands for only
>> +packages in the list. When `nil', never run commands.  Otherwise
>> +when non-`nil', run commands for any package with :make or
>> +:shell-command specified.
>
> Watch out.  According to (elisp) Documentation Tips, nil is not quoted.

Good to know! Fixed.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-package-vc-Process-make-and-shell-command-spec-args.patch --]
[-- Type: text/x-diff, Size: 4126 bytes --]

From 812e32ea6c3f7b2d71174658db0e272b0b4fb84b Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 13 May 2023 10:05:04 -0700
Subject: [PATCH] package-vc: Process :make and :shell-command spec args

---
 doc/emacs/package.texi        |  9 ++++++++
 lisp/emacs-lisp/package-vc.el | 42 +++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index 6722185cb20..4f606b22e54 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -682,6 +682,15 @@ A string providing the repository-relative name of the documentation
 file from which to build an Info file.  This can be a Texinfo file or
 an Org file.
 
+@item :make
+A string or list of strings providing the target or targets defined in
+the repository Makefile which should run before building the Info
+file. Only takes effect when package-vc-allow-side-effects is non-nil.
+
+@item :shell-command
+A string providing the shell command to run before building the Info
+file. Only takes effect when package-vc-allow-side-effects is non-nil.
+
 @item :vc-backend
 A symbol naming the VC backend to use for downloading a copy of the
 package's repository (@pxref{Version Control Systems,,,emacs, The GNU
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index beca0bd00e2..d2f6d287224 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -344,6 +344,38 @@ asynchronously."
         "\n")
        nil pkg-file nil 'silent))))
 
+(defcustom package-vc-allow-side-effects nil
+  "Whether to process :make and :shell-command spec arguments.
+
+It may be necessary to run :make and :shell-command arguments in
+order to initialize a package or build its documentation, but
+please be careful when changing this option, as installing and
+updating a package can run potentially harmful code.
+
+When set to a list of symbols (packages), run commands for only
+packages in the list. When nil, never run commands.  Otherwise
+when non-nil, run commands for any package with :make or
+:shell-command specified.
+
+Package specs are loaded from trusted package archives."
+  :type '(choice (const :tag "Run for all packages" t)
+                 (repeat :tag "Run only for selected packages" (symbol :tag "Package name"))
+                 (const :tag "Never run" nil))
+  :version "30.1")
+
+(defun package-vc--make (pkg-spec pkg-desc)
+  "Process :make and :shell-command PKG-SPEC arguments for PKG-DESC."
+  (let ((target (plist-get pkg-spec :make))
+        (cmd (plist-get pkg-spec :shell-command))
+        (buf (format " *package-vc make %s*" (package-desc-name pkg-desc))))
+    (when (or cmd target)
+      (with-current-buffer (get-buffer-create buf)
+        (erase-buffer)
+        (when (and cmd (/= 0 (call-process shell-file-name nil t nil shell-command-switch cmd)))
+          (warn "Failed to run %s, see buffer %S" cmd (buffer-name)))
+        (when (and target (/= 0 (apply #'call-process "make" nil t nil (if (consp target) target (list target)))))
+          (warn "Failed to make %s, see buffer %S" target (buffer-name)))))))
+
 (declare-function org-export-to-file "ox" (backend file))
 
 (defun package-vc--build-documentation (pkg-desc file)
@@ -486,6 +518,16 @@ documentation and marking the package as installed."
       ;; Generate package file
       (package-vc--generate-description-file pkg-desc pkg-file)
 
+      ;; Process :make and :shell-command arguments before building documentation
+      (pcase package-vc-allow-side-effects
+        ('nil         ; When `nil', do nothing.
+         nil)
+        ((pred consp) ; When non-`nil' list, check if package is on the list.
+         (when (memq (package-desc-name pkg-desc) package-vc-allow-side-effects)
+           (package-vc--make pkg-spec pkg-desc)))
+        (_            ; When otherwise non-`nil', run commands.
+         (package-vc--make pkg-spec pkg-desc)))
+
       ;; Detect a manual
       (when (executable-find "install-info")
         (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))
-- 
2.40.1


^ permalink raw reply related	[relevance 8%]

* bug#63509: [PATCH] Make copy-tree work with records
@ 2023-05-15  3:57 10% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-15 11:26  0% ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-15  3:57 UTC (permalink / raw)
  To: 63509

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

Hello,

copy-tree does not currently work with records:

(cl-defstruct foo bar)
(let* ((rec (make-foo :bar "hello"))
       (copy (copy-tree rec t)))
  (setf (foo-bar copy) "goodbye")
  (foo-bar rec))

Expected "hello"; actual "goodbye".

Attached patch fixes this behavior.

Please tell me if I misunderstand the intended behavior of copy-tree.

Thank you,

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-copy-tree-work-with-records.patch --]
[-- Type: text/x-diff, Size: 1440 bytes --]

From a20e119a0f60f85039726bf6ebcbe441060f9ef2 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sun, 14 May 2023 21:02:15 -0700
Subject: [PATCH] Make copy-tree work with records

---
 lisp/subr.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 03d3324f3d8..9573b19ae7e 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -828,7 +828,7 @@ of course, also replace TO with a slightly larger value
   "Make a copy of TREE.
 If TREE is a cons cell, this recursively copies both its car and its cdr.
 Contrast to `copy-sequence', which copies only along the cdrs.  With second
-argument VECP, this copies vectors as well as conses."
+argument VECP, this copies vectors and records as well as conses."
   (declare (side-effect-free error-free))
   (if (consp tree)
       (let (result)
@@ -839,8 +839,8 @@ argument VECP, this copies vectors as well as conses."
 	    (push newcar result))
 	  (setq tree (cdr tree)))
 	(nconc (nreverse result)
-               (if (and vecp (vectorp tree)) (copy-tree tree vecp) tree)))
-    (if (and vecp (vectorp tree))
+               (if (and vecp (or (vectorp tree) (recordp tree))) (copy-tree tree vecp) tree)))
+    (if (and vecp (or (vectorp tree) (recordp tree)))
 	(let ((i (length (setq tree (copy-sequence tree)))))
 	  (while (>= (setq i (1- i)) 0)
 	    (aset tree i (copy-tree (aref tree i) vecp)))
-- 
2.40.1


^ permalink raw reply related	[relevance 10%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
@ 2023-05-15  5:56 10% ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-15 11:31  0%   ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-15  5:56 UTC (permalink / raw)
  To: 63513; +Cc: Adam Porter

[-- Attachment #1: Type: text/plain, Size: 964 bytes --]

Hello!

persist-defvar does not persist records or hash tables correctly.

Here's a minimal example with a hash table:

(progn
  (persist-defvar foo (make-hash-table :test #'equal) "docstring")
  (puthash 'bar t foo)
  (persist-save 'foo)
  (gethash 'bar (persist-default 'foo))) ;; Expected nil, got t

This patch fixes persisting records by using copy-tree. Currently,
copy-tree does not work with records (see
<https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-05/msg00875.html>).
The following snippet will return the expected value only when both this
patch and the above-linked patch are applied:

(progn
  (cl-defstruct baz a)
  (persist-defvar quux (make-baz :a nil) "docstring")
  (setf (baz-a quux) t)
  (persist-save 'quux)
  (baz-a (persist-default 'quux))) ;; Expected nil, got t

Before applying this patch, the updated values in both cases are not
persisted to disk. With the patch, the updated values are persisted as
expected.

Best,

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-persist-defvar-work-with-records-and-hash-table.patch --]
[-- Type: text/x-diff, Size: 1141 bytes --]

From b1512983fb82b9800ab6d0d1c9ca359e1251e94a Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sun, 14 May 2023 22:32:16 -0700
Subject: [PATCH] Make persist-defvar work with records and hash tables

Previously, when persist-defvar received a record or hash table for an
initial value, updated values were not persisted. This was because the
value and default value shared the same structure.
---
 persist.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/persist.el b/persist.el
index d80943d19e..a40fc2b297 100644
--- a/persist.el
+++ b/persist.el
@@ -118,7 +118,9 @@ (defun persist-symbol (symbol &optional initvalue)
   (let ((initvalue (or initvalue (symbol-value symbol))))
     (add-to-list 'persist--symbols symbol)
     (put symbol 'persist t)
-    (put symbol 'persist-default initvalue)))
+    (if (eq 'hash-table (type-of initvalue))
+        (put symbol 'persist-default (copy-hash-table initvalue))
+      (put symbol 'persist-default (copy-tree initvalue t)))))
 
 (defun persist--persistant-p (symbol)
   "Return non-nil if SYMBOL is a persistant variable."
-- 
2.40.1


^ permalink raw reply related	[relevance 10%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-14 23:01  8%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-15  9:12  5%                 ` Philip Kaludercic
  2023-05-15 19:03  5%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-05-15  9:12 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63336

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>
>>> Philip Kaludercic <philipk@posteo.net> writes:
>>>
>>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>>>
>>>>> Philip Kaludercic <philipk@posteo.net> writes:
>>>>>
>>>>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>>> We also might want to add another option for
>>> package-vc-allow-side-effects like 'user-defined, which only runs :make
>>> and :shell-command args which were specified by the user (as opposed to
>>> those which were downloaded from elpa). WDYT?
>>
>> That sounds like a good idea, but let us do that in a separate patch.
>
> Okay!
>
>>> To update the manual, shall I edit doc/emacs/package.texi directly or is
>>> there another file to edit?
>>
>> Yes, just update the table under the "Specifying Package Sources" subsection.
>
> See patch.
>
>>>> If :shell-command fails, do we really want to proceed to :make?
>>>
>>> Up to you! I was following the lead of elpa-admin.el.
>>
>> In that case let us do that too, unless there is a good reason not to.
>
> +1
>
>>> I switched the first two cases. I think pcase is readable here,
>>> especially if we add an 'user-defined option. What would you use
>>> instead?
>>
>> I would have just used a regular cond.
>>
>> --8<---------------cut here---------------start------------->8---
>> (cond
>>  ((null package-vc-process-make)
>>   ...)
>>  ((listp package-vc-process-make)
>>   ...)
>>  (...))
>> --8<---------------cut here---------------end--------------->8---
>>
>> But this doesn't matter, do what you prefer.
>
> Thank you! I like pcase here.
>
>>> +Be careful when changing this option as processing :make and
>>> +:shell-command will run potentially harmful code.
>>
>> Sounds scary.  I guess that is the point, but what do you think about
>> something like
>>
>>   Be careful when changing this option, as installing and updating a
>>   package can potentially run harmful code.  If possible, allow packages
>>   you trust to run code, if it is necessary for a package to be properly
>>   initialised.
>
> Thank you! What do you think about the version in the attached patch?
>
>>> +When set to a list of symbols (packages), run commands for only
>>> +packages in the list. When `nil', never run commands.  Otherwise
>>> +when non-`nil', run commands for any package with :make or
>>> +:shell-command specified.
>>
>> Watch out.  According to (elisp) Documentation Tips, nil is not quoted.
>
> Good to know! Fixed.
>
> From 812e32ea6c3f7b2d71174658db0e272b0b4fb84b Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Sat, 13 May 2023 10:05:04 -0700
> Subject: [PATCH] package-vc: Process :make and :shell-command spec args
>
> ---
>  doc/emacs/package.texi        |  9 ++++++++
>  lisp/emacs-lisp/package-vc.el | 42 +++++++++++++++++++++++++++++++++++
>  2 files changed, 51 insertions(+)
>
> diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
> index 6722185cb20..4f606b22e54 100644
> --- a/doc/emacs/package.texi
> +++ b/doc/emacs/package.texi
> @@ -682,6 +682,15 @@ A string providing the repository-relative name of the documentation
>  file from which to build an Info file.  This can be a Texinfo file or
>  an Org file.
>  
> +@item :make
> +A string or list of strings providing the target or targets defined in
> +the repository Makefile which should run before building the Info
> +file. Only takes effect when package-vc-allow-side-effects is non-nil.

A @var is missing here

> +
> +@item :shell-command
> +A string providing the shell command to run before building the Info
> +file. Only takes effect when package-vc-allow-side-effects is non-nil.

and here.  I can take care of that.

> +
>  @item :vc-backend
>  A symbol naming the VC backend to use for downloading a copy of the
>  package's repository (@pxref{Version Control Systems,,,emacs, The GNU
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index beca0bd00e2..d2f6d287224 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -344,6 +344,38 @@ asynchronously."
>          "\n")
>         nil pkg-file nil 'silent))))
>  
> +(defcustom package-vc-allow-side-effects nil
> +  "Whether to process :make and :shell-command spec arguments.
> +
> +It may be necessary to run :make and :shell-command arguments in
> +order to initialize a package or build its documentation, but
> +please be careful when changing this option, as installing and
> +updating a package can run potentially harmful code.
> +
> +When set to a list of symbols (packages), run commands for only
> +packages in the list. When nil, never run commands.  Otherwise
> +when non-nil, run commands for any package with :make or
> +:shell-command specified.
> +
> +Package specs are loaded from trusted package archives."
> +  :type '(choice (const :tag "Run for all packages" t)
> +                 (repeat :tag "Run only for selected packages" (symbol :tag "Package name"))
> +                 (const :tag "Never run" nil))
> +  :version "30.1")
> +
> +(defun package-vc--make (pkg-spec pkg-desc)
> +  "Process :make and :shell-command PKG-SPEC arguments for PKG-DESC."
> +  (let ((target (plist-get pkg-spec :make))
> +        (cmd (plist-get pkg-spec :shell-command))
> +        (buf (format " *package-vc make %s*" (package-desc-name pkg-desc))))
> +    (when (or cmd target)
> +      (with-current-buffer (get-buffer-create buf)
> +        (erase-buffer)
> +        (when (and cmd (/= 0 (call-process shell-file-name nil t nil shell-command-switch cmd)))
> +          (warn "Failed to run %s, see buffer %S" cmd (buffer-name)))
> +        (when (and target (/= 0 (apply #'call-process "make" nil t nil (if (consp target) target (list target)))))
> +          (warn "Failed to make %s, see buffer %S" target (buffer-name)))))))
> +
>  (declare-function org-export-to-file "ox" (backend file))
>  
>  (defun package-vc--build-documentation (pkg-desc file)
> @@ -486,6 +518,16 @@ documentation and marking the package as installed."
>        ;; Generate package file
>        (package-vc--generate-description-file pkg-desc pkg-file)
>  
> +      ;; Process :make and :shell-command arguments before building documentation
> +      (pcase package-vc-allow-side-effects
> +        ('nil         ; When `nil', do nothing.
> +         nil)
> +        ((pred consp) ; When non-`nil' list, check if package is on the list.
> +         (when (memq (package-desc-name pkg-desc) package-vc-allow-side-effects)
> +           (package-vc--make pkg-spec pkg-desc)))
> +        (_            ; When otherwise non-`nil', run commands.
> +         (package-vc--make pkg-spec pkg-desc)))

Thinking about this again, I am still not convinced.  Isn't

--8<---------------cut here---------------start------------->8---
(when (or (eq package-vc-allow-side-effects t)
	  (memq (package-desc-name pkg-desc)
		package-vc-allow-side-effects))
  (package-vc--make pkg-spec pkg-desc))
--8<---------------cut here---------------end--------------->8---

much simpler?  Again, you don't have to prepare another patch, I'm just
interested in what you think.

> +
>        ;; Detect a manual
>        (when (executable-find "install-info")
>          (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))





^ permalink raw reply	[relevance 5%]

* bug#63509: [PATCH] Make copy-tree work with records
  2023-05-15  3:57 10% bug#63509: [PATCH] Make copy-tree work with records Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-15 11:26  0% ` Eli Zaretskii
  2023-05-15 17:59  7%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-05-15 11:26 UTC (permalink / raw)
  To: Joseph Turner, Stefan Monnier; +Cc: 63509

> Date: Sun, 14 May 2023 20:57:17 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> copy-tree does not currently work with records:

It isn't documented to work with anything but cons cells or vectors.

> Attached patch fixes this behavior.

Thanks, but such a change must come with:

 - NEWS entry
 - update for the ELisp manual
 - preferably added tests to regression-test this feature

I also think we should rename the second argument, as VECP no longer
fits.

> Please tell me if I misunderstand the intended behavior of copy-tree.

Adding Stefan in case he has comments.





^ permalink raw reply	[relevance 0%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  2023-05-15  5:56 10% ` bug#63513: [PATCH] Make persist-defvar work with records and hash tables Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-15 11:31  0%   ` Eli Zaretskii
  2023-05-23 20:14  9%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-05-15 11:31 UTC (permalink / raw)
  To: Joseph Turner, Phillip Lord, Stefan Monnier; +Cc: adam, 63513

> Cc: Adam Porter <adam@alphapapa.net>
> Date: Sun, 14 May 2023 22:56:20 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> persist-defvar does not persist records or hash tables correctly.
> 
> Here's a minimal example with a hash table:
> 
> (progn
>   (persist-defvar foo (make-hash-table :test #'equal) "docstring")
>   (puthash 'bar t foo)
>   (persist-save 'foo)
>   (gethash 'bar (persist-default 'foo))) ;; Expected nil, got t
> 
> This patch fixes persisting records by using copy-tree. Currently,
> copy-tree does not work with records (see
> <https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-05/msg00875.html>).
> The following snippet will return the expected value only when both this
> patch and the above-linked patch are applied:
> 
> (progn
>   (cl-defstruct baz a)
>   (persist-defvar quux (make-baz :a nil) "docstring")
>   (setf (baz-a quux) t)
>   (persist-save 'quux)
>   (baz-a (persist-default 'quux))) ;; Expected nil, got t
> 
> Before applying this patch, the updated values in both cases are not
> persisted to disk. With the patch, the updated values are persisted as
> expected.

Philip, any comments?





^ permalink raw reply	[relevance 0%]

* bug#63509: [PATCH] Make copy-tree work with records
  2023-05-15 11:26  0% ` Eli Zaretskii
@ 2023-05-15 17:59  7%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-18 10:53  0%     ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-15 17:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63509, Stefan Monnier

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:

>  - NEWS entry

I updated the 29 entry. Should I move it to 30?

>  - update for the ELisp manual

Changes made in patch:

- updated the entry in lists.texi
- added a new entry in records.texi
- added entry in the vector group in shortdoc.el

>  - preferably added tests to regression-test this feature

Done.

> I also think we should rename the second argument, as VECP no longer
> fits.

How about VECTOR-LIKE-P? See patch.

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-copy-tree-work-with-records.patch --]
[-- Type: text/x-diff, Size: 6502 bytes --]

From 14383e9fe8a107f597d06ad486a441b761cc6ade Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sun, 14 May 2023 21:02:15 -0700
Subject: [PATCH] Make copy-tree work with records

---
 doc/lispref/lists.texi      |  9 +++++----
 doc/lispref/records.texi    | 12 ++++++++++++
 etc/NEWS.29                 |  5 +++++
 lisp/emacs-lisp/shortdoc.el |  2 ++
 lisp/subr.el                | 14 +++++++-------
 test/lisp/subr-tests.el     | 31 +++++++++++++++++++++++++++++++
 6 files changed, 62 insertions(+), 11 deletions(-)

diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index 22a5f7f1239..16ed0358974 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -696,16 +696,17 @@ not a list, the sequence's elements do not become elements of the
 resulting list.  Instead, the sequence becomes the final @sc{cdr}, like
 any other non-list final argument.
 
-@defun copy-tree tree &optional vecp
+@defun copy-tree tree &optional vector-like-p
 This function returns a copy of the tree @var{tree}.  If @var{tree} is a
 cons cell, this makes a new cons cell with the same @sc{car} and
 @sc{cdr}, then recursively copies the @sc{car} and @sc{cdr} in the
 same way.
 
 Normally, when @var{tree} is anything other than a cons cell,
-@code{copy-tree} simply returns @var{tree}.  However, if @var{vecp} is
-non-@code{nil}, it copies vectors too (and operates recursively on
-their elements).  This function cannot cope with circular lists.
+@code{copy-tree} simply returns @var{tree}.  However, if
+@var{vector-like-p} is non-@code{nil}, it copies vectors and records
+too (and operates recursively on their elements).  This function
+cannot cope with circular lists.
 @end defun
 
 @defun flatten-tree tree
diff --git a/doc/lispref/records.texi b/doc/lispref/records.texi
index 26c6f30a6b5..0f44198a6b0 100644
--- a/doc/lispref/records.texi
+++ b/doc/lispref/records.texi
@@ -81,6 +81,18 @@ This function returns a new record with type @var{type} and
 @end example
 @end defun
 
+@defun copy-tree tree &optional vector-like-p
+This function copies a record when @var{vector-like-p} is
+non-@code{nil}.
+
+@example
+@group
+(copy-tree (record 'foo "a"))
+     @result{} #s(foo "a")
+@end group
+@end example
+@end defun
+
 @node Backward Compatibility
 @section Backward Compatibility
 
diff --git a/etc/NEWS.29 b/etc/NEWS.29
index fa428d9c790..ae9a89203bf 100644
--- a/etc/NEWS.29
+++ b/etc/NEWS.29
@@ -4897,6 +4897,11 @@ Instead, Emacs uses the already-existing 'make-directory' handlers.
 This can let a caller know whether it created DIR.  Formerly,
 'make-directory's return value was unspecified.
 
++++
+** 'copy-tree' now correctly copies records when its optional second
+argument is non-nil.  The second argument has been renamed from VECP
+to VECTOR-LIKE-P since it now works with both vectors and records.
+
 \f
 * Changes in Emacs 29.1 on Non-Free Operating Systems
 
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index 9a6f5dd12ce..6580e0e4e0c 100644
--- a/lisp/emacs-lisp/shortdoc.el
+++ b/lisp/emacs-lisp/shortdoc.el
@@ -833,6 +833,8 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
   (seq-subseq
    :eval (seq-subseq [1 2 3 4 5] 1 3)
    :eval (seq-subseq [1 2 3 4 5] 1))
+  (copy-tree
+   :eval (copy-tree [1 2 3 4]))
   "Mapping Over Vectors"
   (mapcar
    :eval (mapcar #'identity [1 2 3]))
diff --git a/lisp/subr.el b/lisp/subr.el
index 03d3324f3d8..83735933963 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -824,26 +824,26 @@ of course, also replace TO with a slightly larger value
                 next (+ from (* n inc)))))
       (nreverse seq))))
 
-(defun copy-tree (tree &optional vecp)
+(defun copy-tree (tree &optional vector-like-p)
   "Make a copy of TREE.
 If TREE is a cons cell, this recursively copies both its car and its cdr.
 Contrast to `copy-sequence', which copies only along the cdrs.  With second
-argument VECP, this copies vectors as well as conses."
+argument VECTOR-LIKE-P, this copies vectors and records as well as conses."
   (declare (side-effect-free error-free))
   (if (consp tree)
       (let (result)
 	(while (consp tree)
 	  (let ((newcar (car tree)))
-	    (if (or (consp (car tree)) (and vecp (vectorp (car tree))))
-		(setq newcar (copy-tree (car tree) vecp)))
+	    (if (or (consp (car tree)) (and vector-like-p (or (vectorp (car tree)) (recordp (car tree)))))
+		(setq newcar (copy-tree (car tree) vector-like-p)))
 	    (push newcar result))
 	  (setq tree (cdr tree)))
 	(nconc (nreverse result)
-               (if (and vecp (vectorp tree)) (copy-tree tree vecp) tree)))
-    (if (and vecp (vectorp tree))
+               (if (and vector-like-p (or (vectorp tree) (recordp tree))) (copy-tree tree vector-like-p) tree)))
+    (if (and vector-like-p (or (vectorp tree) (recordp tree)))
 	(let ((i (length (setq tree (copy-sequence tree)))))
 	  (while (>= (setq i (1- i)) 0)
-	    (aset tree i (copy-tree (aref tree i) vecp)))
+	    (aset tree i (copy-tree (aref tree i) vector-like-p)))
 	  tree)
       tree)))
 
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index 8f46c2af136..4ebb68556be 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -1206,5 +1206,36 @@ final or penultimate step during initialization."))
     (should (equal a-dedup '("a" "b" "a" "b" "c")))
     (should (eq a a-dedup))))
 
+(ert-deftest subr--copy-tree ()
+  (should (eq (copy-tree nil) nil))
+  (let* ((a (list (list "a") "b" (list "c") "g"))
+         (copy1 (copy-tree a))
+         (copy2 (copy-tree a t)))
+    (should (equal a copy1))
+    (should (equal a copy2))
+    (should-not (eq a copy1))
+    (should-not (eq a copy2)))
+  (let* ((a (list (list "a") "b" (list "c" (record 'foo "d")) (list ["e" "f"]) "g"))
+         (copy1 (copy-tree a))
+         (copy2 (copy-tree a t)))
+    (should (equal a copy1))
+    (should (equal a copy2))
+    (should-not (eq a copy1))
+    (should-not (eq a copy2)))
+  (let* ((a (record 'foo "a" (record 'bar "b")))
+         (copy1 (copy-tree a))
+         (copy2 (copy-tree a t)))
+    (should (equal a copy1))
+    (should (equal a copy2))
+    (should (eq a copy1))
+    (should-not (eq a copy2)))
+  (let* ((a ["a" "b" ["c" ["d"]]])
+         (copy1 (copy-tree a))
+         (copy2 (copy-tree a t)))
+    (should (equal a copy1))
+    (should (equal a copy2))
+    (should (eq a copy1))
+    (should-not (eq a copy2))))
+
 (provide 'subr-tests)
 ;;; subr-tests.el ends here
-- 
2.40.1


^ permalink raw reply related	[relevance 7%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-15  9:12  5%                 ` Philip Kaludercic
@ 2023-05-15 19:03  5%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
    0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-15 19:03 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63336


Philip Kaludercic <philipk@posteo.net> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Philip Kaludercic <philipk@posteo.net> writes:
>>
>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>>
>>>> Philip Kaludercic <philipk@posteo.net> writes:
>>>>
>>>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>>>>
>>>>>> Philip Kaludercic <philipk@posteo.net> writes:
>>>>>>
>>>>>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>
>>>> We also might want to add another option for
>>>> package-vc-allow-side-effects like 'user-defined, which only runs :make
>>>> and :shell-command args which were specified by the user (as opposed to
>>>> those which were downloaded from elpa). WDYT?
>>>
>>> That sounds like a good idea, but let us do that in a separate patch.
>>
>> Okay!
>>
>>>> To update the manual, shall I edit doc/emacs/package.texi directly or is
>>>> there another file to edit?
>>>
>>> Yes, just update the table under the "Specifying Package Sources" subsection.
>>
>> See patch.
>>
>>>>> If :shell-command fails, do we really want to proceed to :make?
>>>>
>>>> Up to you! I was following the lead of elpa-admin.el.
>>>
>>> In that case let us do that too, unless there is a good reason not to.
>>
>> +1
>>
>>>> I switched the first two cases. I think pcase is readable here,
>>>> especially if we add an 'user-defined option. What would you use
>>>> instead?
>>>
>>> I would have just used a regular cond.
>>>
>>> --8<---------------cut here---------------start------------->8---
>>> (cond
>>>  ((null package-vc-process-make)
>>>   ...)
>>>  ((listp package-vc-process-make)
>>>   ...)
>>>  (...))
>>> --8<---------------cut here---------------end--------------->8---
>>>
>>> But this doesn't matter, do what you prefer.
>>
>> Thank you! I like pcase here.
>>
>>>> +Be careful when changing this option as processing :make and
>>>> +:shell-command will run potentially harmful code.
>>>
>>> Sounds scary.  I guess that is the point, but what do you think about
>>> something like
>>>
>>>   Be careful when changing this option, as installing and updating a
>>>   package can potentially run harmful code.  If possible, allow packages
>>>   you trust to run code, if it is necessary for a package to be properly
>>>   initialised.
>>
>> Thank you! What do you think about the version in the attached patch?
>>
>>>> +When set to a list of symbols (packages), run commands for only
>>>> +packages in the list. When `nil', never run commands.  Otherwise
>>>> +when non-`nil', run commands for any package with :make or
>>>> +:shell-command specified.
>>>
>>> Watch out.  According to (elisp) Documentation Tips, nil is not quoted.
>>
>> Good to know! Fixed.
>>
>> From 812e32ea6c3f7b2d71174658db0e272b0b4fb84b Mon Sep 17 00:00:00 2001
>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Date: Sat, 13 May 2023 10:05:04 -0700
>> Subject: [PATCH] package-vc: Process :make and :shell-command spec args
>>
>> ---
>>  doc/emacs/package.texi        |  9 ++++++++
>>  lisp/emacs-lisp/package-vc.el | 42 +++++++++++++++++++++++++++++++++++
>>  2 files changed, 51 insertions(+)
>>
>> diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
>> index 6722185cb20..4f606b22e54 100644
>> --- a/doc/emacs/package.texi
>> +++ b/doc/emacs/package.texi
>> @@ -682,6 +682,15 @@ A string providing the repository-relative name of the documentation
>>  file from which to build an Info file.  This can be a Texinfo file or
>>  an Org file.
>>
>> +@item :make
>> +A string or list of strings providing the target or targets defined in
>> +the repository Makefile which should run before building the Info
>> +file. Only takes effect when package-vc-allow-side-effects is non-nil.
>
> A @var is missing here

Thank you!

>> +
>> +@item :shell-command
>> +A string providing the shell command to run before building the Info
>> +file. Only takes effect when package-vc-allow-side-effects is non-nil.
>
> and here.  I can take care of that.

Thank you!

>> +
>>  @item :vc-backend
>>  A symbol naming the VC backend to use for downloading a copy of the
>>  package's repository (@pxref{Version Control Systems,,,emacs, The GNU
>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>> index beca0bd00e2..d2f6d287224 100644
>> --- a/lisp/emacs-lisp/package-vc.el
>> +++ b/lisp/emacs-lisp/package-vc.el
>> @@ -344,6 +344,38 @@ asynchronously."
>>          "\n")
>>         nil pkg-file nil 'silent))))
>>
>> +(defcustom package-vc-allow-side-effects nil
>> +  "Whether to process :make and :shell-command spec arguments.
>> +
>> +It may be necessary to run :make and :shell-command arguments in
>> +order to initialize a package or build its documentation, but
>> +please be careful when changing this option, as installing and
>> +updating a package can run potentially harmful code.
>> +
>> +When set to a list of symbols (packages), run commands for only
>> +packages in the list. When nil, never run commands.  Otherwise
>> +when non-nil, run commands for any package with :make or
>> +:shell-command specified.
>> +
>> +Package specs are loaded from trusted package archives."
>> +  :type '(choice (const :tag "Run for all packages" t)
>> +                 (repeat :tag "Run only for selected packages" (symbol :tag "Package name"))
>> +                 (const :tag "Never run" nil))
>> +  :version "30.1")
>> +
>> +(defun package-vc--make (pkg-spec pkg-desc)
>> +  "Process :make and :shell-command PKG-SPEC arguments for PKG-DESC."
>> +  (let ((target (plist-get pkg-spec :make))
>> +        (cmd (plist-get pkg-spec :shell-command))
>> +        (buf (format " *package-vc make %s*" (package-desc-name pkg-desc))))
>> +    (when (or cmd target)
>> +      (with-current-buffer (get-buffer-create buf)
>> +        (erase-buffer)
>> +        (when (and cmd (/= 0 (call-process shell-file-name nil t nil shell-command-switch cmd)))
>> +          (warn "Failed to run %s, see buffer %S" cmd (buffer-name)))
>> +        (when (and target (/= 0 (apply #'call-process "make" nil t nil (if (consp target) target (list target)))))
>> +          (warn "Failed to make %s, see buffer %S" target (buffer-name)))))))
>> +
>>  (declare-function org-export-to-file "ox" (backend file))
>>
>>  (defun package-vc--build-documentation (pkg-desc file)
>> @@ -486,6 +518,16 @@ documentation and marking the package as installed."
>>        ;; Generate package file
>>        (package-vc--generate-description-file pkg-desc pkg-file)
>>
>> +      ;; Process :make and :shell-command arguments before building documentation
>> +      (pcase package-vc-allow-side-effects
>> +        ('nil         ; When `nil', do nothing.
>> +         nil)
>> +        ((pred consp) ; When non-`nil' list, check if package is on the list.
>> +         (when (memq (package-desc-name pkg-desc) package-vc-allow-side-effects)
>> +           (package-vc--make pkg-spec pkg-desc)))
>> +        (_            ; When otherwise non-`nil', run commands.
>> +         (package-vc--make pkg-spec pkg-desc)))
>
> Thinking about this again, I am still not convinced.  Isn't
>
> --8<---------------cut here---------------start------------->8---
> (when (or (eq package-vc-allow-side-effects t)
> 	  (memq (package-desc-name pkg-desc)
> 		package-vc-allow-side-effects))
>   (package-vc--make pkg-spec pkg-desc))
> --8<---------------cut here---------------end--------------->8---
>
> much simpler?  Again, you don't have to prepare another patch, I'm just
> interested in what you think.

I take it all back and insist upon the opposite :)

You are right, that's much simpler.

>> +
>>        ;; Detect a manual
>>        (when (executable-find "install-info")
>>          (dolist (doc-file (ensure-list (plist-get pkg-spec :doc)))





^ permalink raw reply	[relevance 5%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  @ 2023-05-16 21:08  5%                       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-17 14:07  5%                         ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-16 21:08 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 63336-done

Philip Kaludercic <philipk@posteo.net> writes:

> I've pushed the changes to master.  If you are still interested in
> improving the granularity of the issue, create a new report when you
> have a patch we can discuss.

Thank you! I assume you're referring to something like a 'user-defined
option for package-vc-allow-side-effects. At some point, I may submit
another patch adding that feature!

Best,

Joseph





^ permalink raw reply	[relevance 5%]

* bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args
  2023-05-16 21:08  5%                       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-17 14:07  5%                         ` Philip Kaludercic
  0 siblings, 0 replies; 200+ results
From: Philip Kaludercic @ 2023-05-17 14:07 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63336-done

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> I've pushed the changes to master.  If you are still interested in
>> improving the granularity of the issue, create a new report when you
>> have a patch we can discuss.
>
> Thank you! I assume you're referring to something like a 'user-defined
> option for package-vc-allow-side-effects. 

Right,

>                                           At some point, I may submit
> another patch adding that feature!

but there is no hurry for that.

> Best,
>
> Joseph





^ permalink raw reply	[relevance 5%]

* bug#63509: [PATCH] Make copy-tree work with records
  2023-05-15 17:59  7%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-18 10:53  0%     ` Eli Zaretskii
  2023-05-18 19:05  7%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-05-18 10:53 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63509, monnier

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 63509@debbugs.gnu.org
> Date: Mon, 15 May 2023 10:59:57 -0700
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >  - NEWS entry
> 
> I updated the 29 entry. Should I move it to 30?

Yes, this new feature will be installed on the master branch, which
will become Emacs 30.

> --- a/doc/lispref/records.texi
> +++ b/doc/lispref/records.texi
> @@ -81,6 +81,18 @@ This function returns a new record with type @var{type} and
>  @end example
>  @end defun
>  
> +@defun copy-tree tree &optional vector-like-p
> +This function copies a record when @var{vector-like-p} is
> +non-@code{nil}.
> +
> +@example
> +@group
> +(copy-tree (record 'foo "a"))
> +     @result{} #s(foo "a")
> +@end group
> +@end example
> +@end defun

This addition is redundant.  We don't describe the same function in
more than one place.  If there are reasons to mention it in other
places, we just add there a short note with a cross-reference to the
detailed description.

> ++++
> +** 'copy-tree' now correctly copies records when its optional second

The "correctly" part hints that the previous behavior was a bug, which
it wasn't (and we don't mention bugfixes in NEWS anyway).  So I would
rephrase

  'copy-tree' can now copy records as well, when its optional...

> +argument is non-nil.  The second argument has been renamed from VECP
> +to VECTOR-LIKE-P since it now works with both vectors and records.

The last sentence should be removed: we don't mention such minor
details in NEWS, unless the change is an incompatible change.

Last, but not least: please always accompany your changes with
ChageLog-style commit log messages describing the changes.  You can
find more information about this in the file CONTRIBUTE in the Emacs
tree, and you can see many examples by typing "git log" in the
repository.

Thanks.





^ permalink raw reply	[relevance 0%]

* bug#63509: [PATCH] Make copy-tree work with records
  2023-05-18 10:53  0%     ` Eli Zaretskii
@ 2023-05-18 19:05  7%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-19  6:07  0%         ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-18 19:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63509, monnier

[-- Attachment #1: Type: text/plain, Size: 1877 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:

> Yes, this new feature will be installed on the master branch, which
> will become Emacs 30.

Moved note from NEWS.29 to NEWS.

>> --- a/doc/lispref/records.texi
>> +++ b/doc/lispref/records.texi
>> @@ -81,6 +81,18 @@ This function returns a new record with type @var{type} and
>>  @end example
>>  @end defun
>>
>> +@defun copy-tree tree &optional vector-like-p
>> +This function copies a record when @var{vector-like-p} is
>> +non-@code{nil}.
>> +
>> +@example
>> +@group
>> +(copy-tree (record 'foo "a"))
>> +     @result{} #s(foo "a")
>> +@end group
>> +@end example
>> +@end defun
>
> This addition is redundant.  We don't describe the same function in
> more than one place.  If there are reasons to mention it in other
> places, we just add there a short note with a cross-reference to the
> detailed description.

Replaced @defun with a short sentence with @pxref.

>> ++++
>> +** 'copy-tree' now correctly copies records when its optional second
>
> The "correctly" part hints that the previous behavior was a bug, which
> it wasn't (and we don't mention bugfixes in NEWS anyway).  So I would
> rephrase
>
>   'copy-tree' can now copy records as well, when its optional...
>
>> +argument is non-nil.  The second argument has been renamed from VECP
>> +to VECTOR-LIKE-P since it now works with both vectors and records.
>
> The last sentence should be removed: we don't mention such minor
> details in NEWS, unless the change is an incompatible change.

Done.

> Last, but not least: please always accompany your changes with
> ChageLog-style commit log messages describing the changes.  You can
> find more information about this in the file CONTRIBUTE in the Emacs
> tree, and you can see many examples by typing "git log" in the
> repository.

Done.

Please let me know if any further changes need to be made!

Best,

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-copy-tree-work-with-records.patch --]
[-- Type: text/x-diff, Size: 6739 bytes --]

From 0ae16ca89e581d3c732607b2daa700d8316a71e3 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sun, 14 May 2023 21:02:15 -0700
Subject: [PATCH] Make copy-tree work with records

* doc/lispref/lists.texi (Building Cons Cells and Lists): Document new
behavior of copy-tree.
* doc/lispref/records.texi (Record Functions): Cross-reference to
lists.texi.
* etc/NEWS: Mention change.  (Bug#63509)
* lisp/emacs-lisp/shortdoc.el: Add copy-tree example to vector group.
* lisp/subr.el (copy-tree): Recurse into records as well as vectors
when optional second argument is non-nil. Rename second argument to
from vecp to vector-like-p.
* test/lisp/subr-tests.el: Test new behavior.
---
 doc/lispref/lists.texi      |  9 +++++----
 doc/lispref/records.texi    |  3 +++
 etc/NEWS                    |  3 +++
 lisp/emacs-lisp/shortdoc.el |  2 ++
 lisp/subr.el                | 14 +++++++-------
 test/lisp/subr-tests.el     | 31 +++++++++++++++++++++++++++++++
 6 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index 22a5f7f1239..16ed0358974 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -696,16 +696,17 @@ not a list, the sequence's elements do not become elements of the
 resulting list.  Instead, the sequence becomes the final @sc{cdr}, like
 any other non-list final argument.
 
-@defun copy-tree tree &optional vecp
+@defun copy-tree tree &optional vector-like-p
 This function returns a copy of the tree @var{tree}.  If @var{tree} is a
 cons cell, this makes a new cons cell with the same @sc{car} and
 @sc{cdr}, then recursively copies the @sc{car} and @sc{cdr} in the
 same way.
 
 Normally, when @var{tree} is anything other than a cons cell,
-@code{copy-tree} simply returns @var{tree}.  However, if @var{vecp} is
-non-@code{nil}, it copies vectors too (and operates recursively on
-their elements).  This function cannot cope with circular lists.
+@code{copy-tree} simply returns @var{tree}.  However, if
+@var{vector-like-p} is non-@code{nil}, it copies vectors and records
+too (and operates recursively on their elements).  This function
+cannot cope with circular lists.
 @end defun
 
 @defun flatten-tree tree
diff --git a/doc/lispref/records.texi b/doc/lispref/records.texi
index 26c6f30a6b5..d2c80a27f98 100644
--- a/doc/lispref/records.texi
+++ b/doc/lispref/records.texi
@@ -81,6 +81,9 @@ This function returns a new record with type @var{type} and
 @end example
 @end defun
 
+@code{copy-tree} works with records when its optional second argument
+is non-@code{nil} (@pxref{Building Lists}).
+
 @node Backward Compatibility
 @section Backward Compatibility
 
diff --git a/etc/NEWS b/etc/NEWS
index ce865c9904d..c5063a718b9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -585,6 +585,9 @@ Since circular alias chains now cannot occur, 'function-alias-p',
 'indirect-function' and 'indirect-variable' will never signal an error.
 Their 'noerror' arguments have no effect and are therefore obsolete.
 
++++
+** 'copy-tree' now copies records when its optional argument is non-nil.
+
 \f
 * Changes in Emacs 30.1 on Non-Free Operating Systems
 
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index 9a6f5dd12ce..6580e0e4e0c 100644
--- a/lisp/emacs-lisp/shortdoc.el
+++ b/lisp/emacs-lisp/shortdoc.el
@@ -833,6 +833,8 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'),
   (seq-subseq
    :eval (seq-subseq [1 2 3 4 5] 1 3)
    :eval (seq-subseq [1 2 3 4 5] 1))
+  (copy-tree
+   :eval (copy-tree [1 2 3 4]))
   "Mapping Over Vectors"
   (mapcar
    :eval (mapcar #'identity [1 2 3]))
diff --git a/lisp/subr.el b/lisp/subr.el
index 03d3324f3d8..83735933963 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -824,26 +824,26 @@ of course, also replace TO with a slightly larger value
                 next (+ from (* n inc)))))
       (nreverse seq))))
 
-(defun copy-tree (tree &optional vecp)
+(defun copy-tree (tree &optional vector-like-p)
   "Make a copy of TREE.
 If TREE is a cons cell, this recursively copies both its car and its cdr.
 Contrast to `copy-sequence', which copies only along the cdrs.  With second
-argument VECP, this copies vectors as well as conses."
+argument VECTOR-LIKE-P, this copies vectors and records as well as conses."
   (declare (side-effect-free error-free))
   (if (consp tree)
       (let (result)
 	(while (consp tree)
 	  (let ((newcar (car tree)))
-	    (if (or (consp (car tree)) (and vecp (vectorp (car tree))))
-		(setq newcar (copy-tree (car tree) vecp)))
+	    (if (or (consp (car tree)) (and vector-like-p (or (vectorp (car tree)) (recordp (car tree)))))
+		(setq newcar (copy-tree (car tree) vector-like-p)))
 	    (push newcar result))
 	  (setq tree (cdr tree)))
 	(nconc (nreverse result)
-               (if (and vecp (vectorp tree)) (copy-tree tree vecp) tree)))
-    (if (and vecp (vectorp tree))
+               (if (and vector-like-p (or (vectorp tree) (recordp tree))) (copy-tree tree vector-like-p) tree)))
+    (if (and vector-like-p (or (vectorp tree) (recordp tree)))
 	(let ((i (length (setq tree (copy-sequence tree)))))
 	  (while (>= (setq i (1- i)) 0)
-	    (aset tree i (copy-tree (aref tree i) vecp)))
+	    (aset tree i (copy-tree (aref tree i) vector-like-p)))
 	  tree)
       tree)))
 
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index 8f46c2af136..4ebb68556be 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -1206,5 +1206,36 @@ final or penultimate step during initialization."))
     (should (equal a-dedup '("a" "b" "a" "b" "c")))
     (should (eq a a-dedup))))
 
+(ert-deftest subr--copy-tree ()
+  (should (eq (copy-tree nil) nil))
+  (let* ((a (list (list "a") "b" (list "c") "g"))
+         (copy1 (copy-tree a))
+         (copy2 (copy-tree a t)))
+    (should (equal a copy1))
+    (should (equal a copy2))
+    (should-not (eq a copy1))
+    (should-not (eq a copy2)))
+  (let* ((a (list (list "a") "b" (list "c" (record 'foo "d")) (list ["e" "f"]) "g"))
+         (copy1 (copy-tree a))
+         (copy2 (copy-tree a t)))
+    (should (equal a copy1))
+    (should (equal a copy2))
+    (should-not (eq a copy1))
+    (should-not (eq a copy2)))
+  (let* ((a (record 'foo "a" (record 'bar "b")))
+         (copy1 (copy-tree a))
+         (copy2 (copy-tree a t)))
+    (should (equal a copy1))
+    (should (equal a copy2))
+    (should (eq a copy1))
+    (should-not (eq a copy2)))
+  (let* ((a ["a" "b" ["c" ["d"]]])
+         (copy1 (copy-tree a))
+         (copy2 (copy-tree a t)))
+    (should (equal a copy1))
+    (should (equal a copy2))
+    (should (eq a copy1))
+    (should-not (eq a copy2))))
+
 (provide 'subr-tests)
 ;;; subr-tests.el ends here
-- 
2.40.1


^ permalink raw reply related	[relevance 7%]

* bug#63509: [PATCH] Make copy-tree work with records
  2023-05-18 19:05  7%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-19  6:07  0%         ` Eli Zaretskii
  0 siblings, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-05-19  6:07 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63509-done, monnier

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: monnier@iro.umontreal.ca, 63509@debbugs.gnu.org
> Date: Thu, 18 May 2023 12:05:57 -0700
> 
> Please let me know if any further changes need to be made!

Thanks, installed on master, and closing the bug.





^ permalink raw reply	[relevance 0%]

* bug#63671: Add function to test equality of hash tables
@ 2023-05-23 19:32  5% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-23 19:32 UTC (permalink / raw)
  To: 63671

Hello!

Would y'all be open to adding something like this?

(defun hash-equal (hash1 hash2)
  "Return non-nil when the contents of HASH1 and HASH2 are equal.
Table values are compared using `equal' unless they are both hash
tables themselves, in which case `hash-equal' is used.
Does not compare equality predicates."
  (and (= (hash-table-count hash1)
          (hash-table-count hash2))
       (catch 'flag (maphash (lambda (key hash1-value)
                               (let ((hash2-value (gethash key hash2)))
                                 (or (if (and (hash-table-p hash1-value)
                                              (hash-table-p hash2-value))
                                         (hash-equal hash1-value hash2-value)
                                       (equal hash1-value hash2-value))
                                     (throw 'flag nil))))
                             hash1)
              t)))

Rudimentary test:

(let ((hash1 (make-hash-table))
      (hash2 (make-hash-table))
      (hash3 (make-hash-table))
      (hash4 (make-hash-table)))
  (puthash 'foo "foo" hash1)
  (puthash 'foo "foo" hash2)
  (puthash 'bar "foo" hash3)
  (puthash 'bar "foo" hash4)
  (puthash 'baz hash3 hash1)
  (puthash 'baz hash4 hash2)
  (hash-equal hash1 hash2))

We could use hash-table-test to compare predicates, perhaps
dependent on the presence of a 'compare-tests flag?

Best,

Joseph





^ permalink raw reply	[relevance 5%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  2023-05-15 11:31  0%   ` Eli Zaretskii
@ 2023-05-23 20:14  9%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-02 23:54  9%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-23 20:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: adam, 63513, Stefan Monnier, Phillip Lord

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]

The patch should now work on Emacs versions before Emacs 30. I also
added tests for persisting records and hash tables.

Instead of copying the updated behavior of copy-tree into persist.el,
would it be more appropriate to require compat.el?

Best,

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-test-persist-save-macro.patch --]
[-- Type: text/x-diff, Size: 3379 bytes --]

From 7907521e72e2e99b883912f250b7afb14cbf5e80 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 12:57:02 -0700
Subject: [PATCH 1/5] Add test-persist-save macro

---
 test/persist-tests.el | 76 +++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 43 deletions(-)

diff --git a/test/persist-tests.el b/test/persist-tests.el
index b6645a9297..0a85b78767 100644
--- a/test/persist-tests.el
+++ b/test/persist-tests.el
@@ -25,51 +25,41 @@ (ert-deftest test-persist-save-only-persistant ()
    :type 'error
    :exclude-subtypes t))
 
-(ert-deftest test-persist-save ()
-  (with-local-temp-persist
-   (let ((sym (cl-gensym)))
-     ;; precondition
-   (should-not (file-exists-p (persist--file-location sym)))
-     (set sym 10)
-     (persist-symbol sym 10)
-     (persist-save sym)
-     (should t)
-     (should-not (file-exists-p (persist--file-location sym)))
-     (set sym 20)
-     (persist-save sym)
-     (should (file-exists-p (persist--file-location sym)))
-     (should
-      (string-match-p
-       "20"
-       (with-temp-buffer
-         (insert-file-contents (persist--file-location sym))
-         (buffer-string))))
-     (set sym 10)
-     (persist-save sym)
-     (should-not (file-exists-p (persist--file-location sym)))
-     (should-error
-      (persist-save 'fred)))))
+(defmacro test-persist-save (init default change printed-changed)
+  "Test persisting symbols.
+- symbol is not persisted when value is set to INIT and default
+  value is set to DEFAULT.
+- symbol is persisted when value is changed according to CHANGE.
+- persisted file contents match PRINTED-CHANGED.
+- symbol is not persisted after value is set back to DEFAULT."
+  `(with-local-temp-persist
+    (let ((sym (cl-gensym)))
+      (should-not (file-exists-p (persist--file-location sym)))
+      (set sym ,init)
+      (persist-symbol sym ,default)
+      (persist-save sym)
+      (should t)
+      (should-not (file-exists-p (persist--file-location sym)))
+      ,change
+      (persist-save sym)
+      (should (file-exists-p (persist--file-location sym)))
+      (should
+       (string-match-p
+        ,printed-changed
+        (with-temp-buffer
+          (insert-file-contents (persist--file-location sym))
+          (buffer-string))))
+      (set sym ,default)
+      (persist-save sym)
+      (should-not (file-exists-p (persist--file-location sym))))))
 
-(ert-deftest test-persist-save-non-number ()
-  "Test saving something that is not a number.
+(ert-deftest test-persist-save-number ()
+  "Test saving number."
+  (test-persist-save 1 1 (set sym 2) "2"))
 
-`test-persist-save' missed "
-  (with-local-temp-persist
-   (let ((sym (cl-gensym)))
-     (set sym "fred")
-     (persist-symbol sym "fred")
-     (persist-save sym)
-     (should t)
-     (should-not (file-exists-p (persist--file-location sym)))
-     (set sym "george")
-     (persist-save sym)
-     (should (file-exists-p (persist--file-location sym)))
-     (should
-      (string-match-p
-       "george"
-       (with-temp-buffer
-         (insert-file-contents (persist--file-location sym))
-         (buffer-string)))))))
+(ert-deftest test-persist-save-string ()
+  "Test saving string."
+  (test-persist-save "foo" "foo" (set sym "bar") "bar"))
 
 (ert-deftest test-persist-load ()
   (with-local-temp-persist
-- 
2.40.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Add-persist-hash-equal.patch --]
[-- Type: text/x-diff, Size: 1460 bytes --]

From 41f90ac59a26018382d1bb9153af08ce4b9423ff Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 12:52:24 -0700
Subject: [PATCH 2/5] Add persist-hash-equal

See bug#63671.
---
 persist.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/persist.el b/persist.el
index d80943d19e..0069273ca2 100644
--- a/persist.el
+++ b/persist.el
@@ -187,5 +187,22 @@ (defun persist--save-all ()
 (add-hook 'kill-emacs-hook
           'persist--save-all)
 
+(defun persist-hash-equal (hash1 hash2)
+  "Return non-nil when the contents of HASH1 and HASH2 are equal.
+Table values are compared using `equal' unless they are both hash
+tables themselves, in which case `hash-equal' is used.
+Does not compare equality predicates."
+  (and (= (hash-table-count hash1)
+          (hash-table-count hash2))
+       (catch 'flag (maphash (lambda (key hash1-value)
+                               (let ((hash2-value (gethash key hash2)))
+                                 (or (if (and (hash-table-p hash1-value)
+                                              (hash-table-p hash2-value))
+                                         (hash-equal hash1-value hash2-value)
+                                       (equal hash1-value hash2-value))
+                                     (throw 'flag nil))))
+                             hash1)
+              t)))
+
 (provide 'persist)
 ;;; persist.el ends here
-- 
2.40.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Make-persist-defvar-work-with-hash-tables.patch --]
[-- Type: text/x-diff, Size: 2988 bytes --]

From 53e166cb0c7c2624a5a54edafe8828d7b7edc612 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 13:09:29 -0700
Subject: [PATCH 3/5] Make persist-defvar work with hash tables

Previously, when persist-defvar received a hash table for an initial
value, updated values were not persisted.
---
 persist.el            | 16 +++++++++++-----
 test/persist-tests.el |  8 ++++++++
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/persist.el b/persist.el
index 0069273ca2..725f2f71cf 100644
--- a/persist.el
+++ b/persist.el
@@ -118,7 +118,9 @@ (defun persist-symbol (symbol &optional initvalue)
   (let ((initvalue (or initvalue (symbol-value symbol))))
     (add-to-list 'persist--symbols symbol)
     (put symbol 'persist t)
-    (put symbol 'persist-default initvalue)))
+    (if (hash-table-p initvalue)
+        (put symbol 'persist-default (copy-hash-table initvalue))
+      (put symbol 'persist-default initvalue))))
 
 (defun persist--persistant-p (symbol)
   "Return non-nil if SYMBOL is a persistant variable."
@@ -132,9 +134,13 @@ (defun persist-save (symbol)
   (unless (persist--persistant-p symbol)
     (error (format
             "Symbol %s is not persistant" symbol)))
-  (let ((symbol-file-loc (persist--file-location symbol)))
-    (if (equal (symbol-value symbol)
-               (persist-default symbol))
+  (let ((symbol-file-loc (persist--file-location symbol))
+        (value (symbol-value symbol))
+        (default (persist-default symbol)))
+    (if (if (and (hash-table-p value)
+                 (hash-table-p default))
+            (persist-hash-equal value default)
+          (equal value default))
         (when (file-exists-p symbol-file-loc)
           (delete-file symbol-file-loc))
       (let ((dir-loc
@@ -148,7 +154,7 @@ (defun persist-save (symbol)
                 (print-escape-control-characters t)
                 (print-escape-nonascii t)
                 (print-circle t))
-            (print (symbol-value symbol) (current-buffer)))
+            (print value (current-buffer)))
           (write-region (point-min) (point-max)
                         symbol-file-loc
                         nil 'quiet))))))
diff --git a/test/persist-tests.el b/test/persist-tests.el
index 0a85b78767..8a30a24e23 100644
--- a/test/persist-tests.el
+++ b/test/persist-tests.el
@@ -61,6 +61,14 @@ (ert-deftest test-persist-save-string ()
   "Test saving string."
   (test-persist-save "foo" "foo" (set sym "bar") "bar"))
 
+(ert-deftest test-persist-save-hash ()
+  "Test saving hash table."
+  (let* ((hash (make-hash-table))
+         (default (copy-hash-table hash)))
+    (test-persist-save hash default
+                       (puthash 'foo "bar" (symbol-value sym))
+                       "#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data (foo \"bar\"))")))
+
 (ert-deftest test-persist-load ()
   (with-local-temp-persist
    (let ((sym (cl-gensym)))
-- 
2.40.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-Add-persist-copy-tree.patch --]
[-- Type: text/x-diff, Size: 1912 bytes --]

From ccc1be590b6c7b71aaa4ee3dd3bf25184ea7c122 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 13:43:02 -0700
Subject: [PATCH 4/5] Add persist-copy-tree

The behavior of copy-tree was changed in Emacs 30. This function will
ensure that persist works correctly for previous Emacs versions.
---
 persist.el | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/persist.el b/persist.el
index 725f2f71cf..eb408b5dca 100644
--- a/persist.el
+++ b/persist.el
@@ -210,5 +210,34 @@ (defun persist-hash-equal (hash1 hash2)
                              hash1)
               t)))
 
+
+(defun persist-copy-tree (tree &optional vectors-and-records)
+  "Make a copy of TREE.
+If TREE is a cons cell, this recursively copies both its car and its cdr.
+Contrast to `copy-sequence', which copies only along the cdrs.
+With the second argument VECTORS-AND-RECORDS non-nil, this
+traverses and copies vectors and records as well as conses."
+  (declare (side-effect-free error-free))
+  (if (consp tree)
+      (let (result)
+	(while (consp tree)
+	  (let ((newcar (car tree)))
+	    (if (or (consp (car tree))
+                    (and vectors-and-records
+                         (or (vectorp (car tree)) (recordp (car tree)))))
+		(setq newcar (copy-tree (car tree) vectors-and-records)))
+	    (push newcar result))
+	  (setq tree (cdr tree)))
+	(nconc (nreverse result)
+               (if (and vectors-and-records (or (vectorp tree) (recordp tree)))
+                   (copy-tree tree vectors-and-records)
+                 tree)))
+    (if (and vectors-and-records (or (vectorp tree) (recordp tree)))
+	(let ((i (length (setq tree (copy-sequence tree)))))
+	  (while (>= (setq i (1- i)) 0)
+	    (aset tree i (copy-tree (aref tree i) vectors-and-records)))
+	  tree)
+      tree)))
+
 (provide 'persist)
 ;;; persist.el ends here
-- 
2.40.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-Make-persist-defvar-work-with-records.patch --]
[-- Type: text/x-diff, Size: 1763 bytes --]

From 4658bde147253d2f070b14c6f54300f640da063e Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 13:44:40 -0700
Subject: [PATCH 5/5] Make persist-defvar work with records

Previously, when persist-defvar received a record for an initial
value, updated values were not persisted.
---
 persist.el            | 2 +-
 test/persist-tests.el | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/persist.el b/persist.el
index eb408b5dca..39ce54bbf0 100644
--- a/persist.el
+++ b/persist.el
@@ -120,7 +120,7 @@ (defun persist-symbol (symbol &optional initvalue)
     (put symbol 'persist t)
     (if (hash-table-p initvalue)
         (put symbol 'persist-default (copy-hash-table initvalue))
-      (put symbol 'persist-default initvalue))))
+      (put symbol 'persist-default (persist-copy-tree initvalue t)))))
 
 (defun persist--persistant-p (symbol)
   "Return non-nil if SYMBOL is a persistant variable."
diff --git a/test/persist-tests.el b/test/persist-tests.el
index 8a30a24e23..18b8af2b89 100644
--- a/test/persist-tests.el
+++ b/test/persist-tests.el
@@ -69,6 +69,14 @@ (ert-deftest test-persist-save-hash ()
                        (puthash 'foo "bar" (symbol-value sym))
                        "#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data (foo \"bar\"))")))
 
+(ert-deftest test-persist-save-record ()
+  "Test saving record."
+  (let* ((rec (record 'foo 'a 'b))
+         (default (copy-sequence rec)))
+    (test-persist-save rec default
+                       (setf (aref (symbol-value sym) 2) 'quux)
+                       "#s(foo a quux)")))
+
 (ert-deftest test-persist-load ()
   (with-local-temp-persist
    (let ((sym (cl-gensym)))
-- 
2.40.1


^ permalink raw reply related	[relevance 9%]

* bug#63671: Add function to test equality of hash tables
  @ 2023-05-24 17:27  5% ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-24 20:01  5%   ` Ihor Radchenko
  2023-05-24 20:34  4%   ` Mattias Engdegård
  0 siblings, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-24 17:27 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: 63671

Mattias Engdegård <mattias.engdegard@gmail.com> writes:

> Thank you, but this seems a bit too specific to your own requirements
> -- maybe you can keep that procedure locally where you need it?

It's no problem to keep the procedure local.

> The standard library must be generally useful with clear semantics.

Would extending `equal' to handle hash tables be generally useful?

Joseph







^ permalink raw reply	[relevance 5%]

* bug#63671: Add function to test equality of hash tables
  2023-05-24 17:27  5% ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-24 20:01  5%   ` Ihor Radchenko
  2023-05-24 20:34  4%   ` Mattias Engdegård
  1 sibling, 0 replies; 200+ results
From: Ihor Radchenko @ 2023-05-24 20:01 UTC (permalink / raw)
  To: Joseph Turner; +Cc: Mattias Engdegård, 63671

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

>> The standard library must be generally useful with clear semantics.
>
> Would extending `equal' to handle hash tables be generally useful?

See https://yhetil.org/emacs-devel/871qvz4kdw.fsf@localhost/

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





^ permalink raw reply	[relevance 5%]

* bug#63671: Add function to test equality of hash tables
  2023-05-24 17:27  5% ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-24 20:01  5%   ` Ihor Radchenko
@ 2023-05-24 20:34  4%   ` Mattias Engdegård
  2023-05-25  2:44  5%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 200+ results
From: Mattias Engdegård @ 2023-05-24 20:34 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 63671

[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

24 maj 2023 kl. 19.27 skrev Joseph Turner <joseph@breatheoutbreathe.in>:

> Would extending `equal' to handle hash tables be generally useful?

It would, but doing so would be very risky at this point since it would change long-standing semantics.

We could make an augmented version of `equal` but what we really want is one that works for user-defined types (see Ihor's reference to a previous discussion).

Anyway, here's an old patch I had lying around, in case we decide that we do need a shoddy equality predicate for hash tables only.


[-- Attachment #2: hash-table-equal-p.diff --]
[-- Type: application/octet-stream, Size: 3636 bytes --]

diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 9cd793d05c..17ca80a297 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -93,6 +93,28 @@ hash-table-values
   "Return a list of values in HASH-TABLE."
   (cl-loop for v being the hash-values of hash-table collect v))
 
+(defun hash-table-equal-p (h1 h2 &optional value-eq)
+  "Whether the hash tables H1 and H2 are equal with respect to VALUE-EQ.
+Equality means that the tables have the same equality predicate
+and the same set of key-value pairs where keys are compared by
+that predicate and values by VALUE-EQ, which defaults to `eq'."
+  (or (eq h1 h2)
+      (and (= (hash-table-count h1) (hash-table-count h2))
+           (eq (hash-table-test h1) (hash-table-test h2))
+           (progn
+             (unless value-eq
+               (setq value-eq #'eq))
+             ;; Loop over the physically smaller table.
+             (when (> (hash-table-size h1) (hash-table-size h2))
+               (cl-rotatef h1 h2))
+             (catch 'done
+               (maphash
+                (lambda (k v)
+                  (unless (funcall value-eq v (gethash k h2 (not v)))
+                    (throw 'done nil)))
+                h1)
+               t)))))
+
 (defsubst string-empty-p (string)
   "Check whether STRING is empty."
   (string= string ""))
diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el
index 7f3916c2c0..923155eedb 100644
--- a/test/lisp/emacs-lisp/subr-x-tests.el
+++ b/test/lisp/emacs-lisp/subr-x-tests.el
@@ -743,6 +743,55 @@ test-with-buffer-unmodified-if-unchanged
           (with-current-buffer inner
             (should-not (buffer-modified-p))))))))
 
+(ert-deftest subr-x--hash-table-equal-p ()
+  (cl-flet ((hashtab (test &rest elts)
+              (let ((h (make-hash-table :test test)))
+                (while elts
+                  (let* ((key (pop elts))
+                         (val (pop elts)))
+                    (puthash key val h)))
+                h)))
+
+    (let ((h1 (hashtab #'eq 'a (list 1) 'b (list 2))
+          (h2 (hashtab #'eq 'a (list 1) 'b (list 2)))))
+      (should (hash-table-equal-p h1 h2 #'equal))
+      (should (hash-table-equal-p h2 h1 #'equal))
+      (should (not (hash-table-equal-p h1 h2 #'eq)))
+      (should (not (hash-table-equal-p h2 h1 #'eq)))
+      (should (hash-table-equal-p h1 h1 #'eq)))
+
+    (let ((h1 (hashtab #'eql 1 'a 2 'b)
+          (h2 (hashtab #'equal 1 'a 2 'b))))
+      (should (not (hash-table-equal-p h1 h2)))
+      (should (not (hash-table-equal-p h2 h1))))
+
+    (let ((h1 (hashtab #'eql 1 'a 2 'a)
+          (h2 (hashtab #'eql 1 'a))))
+      (should (not (hash-table-equal-p h1 h2)))
+      (should (not (hash-table-equal-p h2 h1))))
+
+    (let ((h1 (hashtab #'eql 1 'a 2 'a)
+          (h2 (hashtab #'eql 1 'a 2 'b))))
+      (should (not (hash-table-equal-p h1 h2)))
+      (should (not (hash-table-equal-p h2 h1))))
+
+    (let ((h1 (hashtab #'eql 1 'a 2 'a)
+          (h2 (hashtab #'eql 1 'a 3 'a))))
+      (should (not (hash-table-equal-p h1 h2)))
+      (should (not (hash-table-equal-p h2 h1))))
+
+    (let ((h1 (hashtab #'eql)
+          (h2 (hashtab #'eql))))
+      (should (hash-table-equal-p h1 h2))
+      (should (hash-table-equal-p h2 h1)))
+
+    (let ((h1 (make-hash-table :test #'eql :size 1000 :rehash-size 3.5))
+          (h2 (hashtab #'eql 10 'a 20 'b)))
+      (puthash 10 'a h1)
+      (puthash 20 'b h1)
+      (should (hash-table-equal-p h1 h2))
+      (should (hash-table-equal-p h2 h1)))
+    ))
 
 (provide 'subr-x-tests)
 ;;; subr-x-tests.el ends here

^ permalink raw reply related	[relevance 4%]

* bug#63671: Add function to test equality of hash tables
  2023-05-24 20:34  4%   ` Mattias Engdegård
@ 2023-05-25  2:44  5%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-25  6:31  5%       ` Ihor Radchenko
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-25  2:44 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: yantar92, 63671


Mattias Engdegård <mattias.engdegard@gmail.com> writes:

> 24 maj 2023 kl. 19.27 skrev Joseph Turner <joseph@breatheoutbreathe.in>:
>
>> Would extending `equal' to handle hash tables be generally useful?
>
> It would, but doing so would be very risky at this point since it would change long-standing semantics.
>
> We could make an augmented version of `equal` but what we really want is one that works for user-defined types (see Ihor's reference to a previous discussion).
>
> Anyway, here's an old patch I had lying around, in case we decide that we do need a shoddy equality predicate for hash tables only.

Thank you for the references, Ihor and Mattias! Since this is a
duplicate of Ihor's thread, my report should probably be closed.

How do I close this report?

Joseph





^ permalink raw reply	[relevance 5%]

* bug#63671: Add function to test equality of hash tables
  2023-05-25  2:44  5%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-25  6:31  5%       ` Ihor Radchenko
  2023-05-25  7:22  5%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-25  7:22  5%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 200+ results
From: Ihor Radchenko @ 2023-05-25  6:31 UTC (permalink / raw)
  To: Joseph Turner; +Cc: Mattias Engdegård, 63671

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Thank you for the references, Ihor and Mattias! Since this is a
> duplicate of Ihor's thread, my report should probably be closed.

If we are serious about adding this feature, lets not close this report.
My email was on emacs-devel, and it is thus less visible compared to
something being tracked on debbugs.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





^ permalink raw reply	[relevance 5%]

* bug#63671: Add function to test equality of hash tables
  2023-05-25  6:31  5%       ` Ihor Radchenko
@ 2023-05-25  7:22  5%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-25  7:22  5%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-25  7:22 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Mattias Engdegård, 63671


Ihor Radchenko <yantar92@posteo.net> writes:

> If we are serious about adding this feature, lets not close this report.
> My email was on emacs-devel, and it is thus less visible compared to
> something being tracked on debbugs.

I would be happy to see this feature added to Emacs! Unfortunately, I
won't be of much help right now since I have no C experience.





^ permalink raw reply	[relevance 5%]

* bug#63671: Add function to test equality of hash tables
  2023-05-25  6:31  5%       ` Ihor Radchenko
  2023-05-25  7:22  5%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-05-25  7:22  5%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-25  7:22 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Mattias Engdegård, 63671


Ihor Radchenko <yantar92@posteo.net> writes:

> If we are serious about adding this feature, lets not close this report.
> My email was on emacs-devel, and it is thus less visible compared to
> something being tracked on debbugs.

I would be happy to see this feature added to Emacs! Unfortunately, I
won't be of much help right now since I have no C experience.





^ permalink raw reply	[relevance 5%]

* bug#64739: (forward-thing 'number) doesn't work with decimal numbers
@ 2023-07-20  6:19  5% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-07-20  6:39  0% ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-07-20  6:19 UTC (permalink / raw)
  To: 64739

Hello,

Given the following number with point at ★:

★12.34

number-at-point correctly returns "12.34".

However,(forward-thing 'number) puts point just before the period:

12★.34

while I'd expect:

12.34★

(get 'number 'forward-op)
     ⇒ forward-word

forward-word doesn't seem to be the correct forward-op for numbers.

Joseph





^ permalink raw reply	[relevance 5%]

* bug#64739: (forward-thing 'number) doesn't work with decimal numbers
  2023-07-20  6:19  5% bug#64739: (forward-thing 'number) doesn't work with decimal numbers Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-07-20  6:39  0% ` Eli Zaretskii
    0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-07-20  6:39 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 64739

> Date: Wed, 19 Jul 2023 23:19:27 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Hello,
> 
> Given the following number with point at ★:
> 
> ★12.34
> 
> number-at-point correctly returns "12.34".
> 
> However,(forward-thing 'number) puts point just before the period:
> 
> 12★.34
> 
> while I'd expect:
> 
> 12.34★
> 
> (get 'number 'forward-op)
>      ⇒ forward-word
> 
> forward-word doesn't seem to be the correct forward-op for numbers.

That depends on the buffer's syntax table, though.





^ permalink raw reply	[relevance 0%]

* bug#64739: (forward-thing 'number) doesn't work with decimal numbers
  @ 2023-07-21 12:48  0%     ` Eli Zaretskii
  2023-07-21 12:52  0%       ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-07-21 12:48 UTC (permalink / raw)
  To: Roland Winkler; +Cc: 64739, joseph

> From: Roland Winkler <winkler@gnu.org>
> Cc: Joseph Turner <joseph@breatheoutbreathe.in>,  64739@debbugs.gnu.org
> Date: Fri, 21 Jul 2023 07:28:29 -0500
> 
> On Thu, Jul 20 2023, Eli Zaretskii wrote:
> >> forward-word doesn't seem to be the correct forward-op for numbers.
> >
> > That depends on the buffer's syntax table, though.
> 
> I am frequently running into similar problems when I deal with numbers,
> but the syntax table is not designed for this.  Would it make sense if
> (forward-thing 'number) temporarily used a customized synatx table?

It should use its own function, if you ask me.  forward-word is a
kludge.





^ permalink raw reply	[relevance 0%]

* bug#64739: (forward-thing 'number) doesn't work with decimal numbers
  2023-07-21 12:48  0%     ` Eli Zaretskii
@ 2023-07-21 12:52  0%       ` Eli Zaretskii
    0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-07-21 12:52 UTC (permalink / raw)
  To: winkler; +Cc: 64739, joseph

> Cc: 64739@debbugs.gnu.org, joseph@breatheoutbreathe.in
> Date: Fri, 21 Jul 2023 15:48:07 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: Roland Winkler <winkler@gnu.org>
> > Cc: Joseph Turner <joseph@breatheoutbreathe.in>,  64739@debbugs.gnu.org
> > Date: Fri, 21 Jul 2023 07:28:29 -0500
> > 
> > On Thu, Jul 20 2023, Eli Zaretskii wrote:
> > >> forward-word doesn't seem to be the correct forward-op for numbers.
> > >
> > > That depends on the buffer's syntax table, though.
> > 
> > I am frequently running into similar problems when I deal with numbers,
> > but the syntax table is not designed for this.  Would it make sense if
> > (forward-thing 'number) temporarily used a customized synatx table?
> 
> It should use its own function, if you ask me.  forward-word is a
> kludge.

To clarify: I meant that using forward-word in this case is a kludge.





^ permalink raw reply	[relevance 0%]

* bug#64739: (forward-thing 'number) doesn't work with decimal numbers
  @ 2023-07-23  3:36  5%             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-07-23  5:33  0%               ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-07-23  3:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64739, Roland Winkler


Eli Zaretskii <eliz@gnu.org> writes:

> By "its own function" I meant that we implement it in Emacs, not that
> you implement it in your personal customizations.

I see that the definition of number-at-point includes two magic regexps,
one matching hex numbers and another matching decimal numbers. Would it
make sense to move those regexps into defconsts, and then create a new
function forward-number which uses those new constants?

Joseph





^ permalink raw reply	[relevance 5%]

* bug#64739: (forward-thing 'number) doesn't work with decimal numbers
  2023-07-23  3:36  5%             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-07-23  5:33  0%               ` Eli Zaretskii
  2023-07-23 19:03  4%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-07-23  5:33 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 64739, winkler

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: Roland Winkler <winkler@gnu.org>, 64739@debbugs.gnu.org
> Date: Sat, 22 Jul 2023 20:36:16 -0700
> 
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > By "its own function" I meant that we implement it in Emacs, not that
> > you implement it in your personal customizations.
> 
> I see that the definition of number-at-point includes two magic regexps,
> one matching hex numbers and another matching decimal numbers. Would it
> make sense to move those regexps into defconsts, and then create a new
> function forward-number which uses those new constants?

That's probably one idea, yes.  (But note that those regexps don't
support numbers like "1.0e2".)

Another idea is to define a special-purpose syntax table and use that
with forward-word.

Yet another idea is to use 'read', since the Lisp reader already knows
how to read numbers.

And there probably are other ideas as well.





^ permalink raw reply	[relevance 0%]

* bug#64739: (forward-thing 'number) doesn't work with decimal numbers
  2023-07-23  5:33  0%               ` Eli Zaretskii
@ 2023-07-23 19:03  4%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-07-24 11:25  0%                   ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-07-23 19:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64739, winkler


Eli Zaretskii <eliz@gnu.org> writes:

>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Cc: Roland Winkler <winkler@gnu.org>, 64739@debbugs.gnu.org
>> Date: Sat, 22 Jul 2023 20:36:16 -0700
>>
>> > By "its own function" I meant that we implement it in Emacs, not that
>> > you implement it in your personal customizations.
>>
>> I see that the definition of number-at-point includes two magic regexps,
>> one matching hex numbers and another matching decimal numbers. Would it
>> make sense to move those regexps into defconsts, and then create a new
>> function forward-number which uses those new constants?
>
> That's probably one idea, yes.  (But note that those regexps don't
> support numbers like "1.0e2".)

I agree that the regexp solution is not ideal.

> Another idea is to define a special-purpose syntax table and use that
> with forward-word.

Did you have something like this in mind?

(defvar number-syntax-table
  (let ((st (make-syntax-table)))
    (modify-syntax-entry ?. "w " st)
    ;; ?- and ?+ could indicate the sign at the beginning of a number or
    ;; they could indicate the sign of an exponent like 1.5e-6
    (modify-syntax-entry ?- "w " st)
    (modify-syntax-entry ?+ "w " st)
    ;; ?# acts as a prefix for integers in bases other than 10.
    (modify-syntax-entry ?# "w " st)
    st)
  "Syntax table used to detect word boundaries for numbers.")

(defun forward-number (&optional n)
  (interactive)
  (with-syntax-table number-syntax-table
    (forward-word-strictly n)))

(defun backward-number (&optional n)
  (interactive)
  (with-syntax-table number-syntax-table
    (forward-word-strictly n)))

;; We don't need the following two lines, since forward-thing uses
;; intern-soft to get these function names anyway.

(put 'number 'forward-op 'forward-number)
(put 'number 'beginning-op 'backward-number)

What would we use for end-op? Is it necessary?

Also I notice that the current implementation of number-at-point fails
to recognize the following as a single number:

-1.5e+6

Could we do something like:

(defun number-at-point (&optional no-properties)
  (with-syntax-table number-syntax-table
    (word-at-point no-properties)))

(put 'number 'thing-at-point 'number-at-point)

I'd appreciate feedback on the syntax table above. It incorrectly
recognizes some non-number strings as numbers:

a-a+a-
#abc#abc

> Yet another idea is to use 'read', since the Lisp reader already knows
> how to read numbers.

Sounds interesting! I'm not sure how to approach a solution like that.
How would you let the Lisp reader know where to start and stop reading?

Joseph





^ permalink raw reply	[relevance 4%]

* bug#64739: (forward-thing 'number) doesn't work with decimal numbers
  2023-07-23 19:03  4%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-07-24 11:25  0%                   ` Eli Zaretskii
    0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-07-24 11:25 UTC (permalink / raw)
  To: Joseph Turner, Stefan Monnier; +Cc: 64739, winkler

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: winkler@gnu.org, 64739@debbugs.gnu.org
> Date: Sun, 23 Jul 2023 12:03:50 -0700
> 
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > That's probably one idea, yes.  (But note that those regexps don't
> > support numbers like "1.0e2".)
> 
> I agree that the regexp solution is not ideal.
> 
> > Another idea is to define a special-purpose syntax table and use that
> > with forward-word.
> 
> Did you have something like this in mind?

More or less.  TBH, I didn't think about this too much, so maybe this
idea doesn't "hold water".

> > Yet another idea is to use 'read', since the Lisp reader already knows
> > how to read numbers.
> 
> Sounds interesting! I'm not sure how to approach a solution like that.
> How would you let the Lisp reader know where to start and stop reading?

Start is easy: 'read' always starts at point.  End might give us
trouble, but in general 'read' reads one expression, so it should stop
at the end of the number, no?

Anyway, I was just brain-storming.  A real solution will need more
thought and more testing.  Perhaps Stefan (CC'ed) has some ideas or
inputs.





^ permalink raw reply	[relevance 0%]

* bug#64739: (forward-thing 'number) doesn't work with decimal numbers
  @ 2023-07-29 23:01  5%                       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-07-29 23:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, 64739, winkler

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> FWIW, I've always found the `thingatpt.el` library to be ..hmm.. wobbly?
> I'd welcome someone investing time to straighten it up (maybe
> starting by extending it so it can return "thing around region" and use
> that as the basis for "at point").

Would you elaborate on this design idea?





^ permalink raw reply	[relevance 5%]

* bug#65243: [PATCH] Fix building of VC package manuals with relative org links/includes
@ 2023-08-12  8:43 10% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-14  8:14  5% ` Philip Kaludercic
  2023-08-19  9:46  5% ` Philip Kaludercic
  0 siblings, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-12  8:43 UTC (permalink / raw)
  To: 65243; +Cc: philipk

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

Hello,

This patch allows for relative includes and link in org files compiled
to texinfo.

Unfortunately, I missed this back in May
(commit 1e6a7594 ), when we fixed relative texi @include links.

I'm not sure how the Emacs release cycle works. Would it be possible to
include this fix in 29.2?

Best,

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-building-of-VC-package-manuals-with-relative-org.patch --]
[-- Type: text/x-diff, Size: 1170 bytes --]

From e951b0ea4ffa90202ecee934eddd895b706c6794 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 12 Aug 2023 01:40:07 -0700
Subject: [PATCH] Fix building of VC package manuals with relative org
 links/includes

* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
Ensure that default-default is the docs-directory around
org-export-to-file to ensure that links to relative files work correctly.
---
 lisp/emacs-lisp/package-vc.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index b4c911015b5..ffc7afeb2ee 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -356,7 +356,8 @@ otherwise it's assumed to be an Info file."
       (with-temp-buffer
         (insert-file-contents file)
         (setq file (make-temp-file "ox-texinfo-"))
-        (org-export-to-file 'texinfo file)
+        (let ((default-directory docs-directory))
+          (org-export-to-file 'texinfo file))
         (setq clean-up t)))
     (with-current-buffer (get-buffer-create " *package-vc doc*")
       (erase-buffer)
-- 
2.41.0


^ permalink raw reply related	[relevance 10%]

* bug#65243: [PATCH] Fix building of VC package manuals with relative org links/includes
  2023-08-12  8:43 10% bug#65243: [PATCH] Fix building of VC package manuals with relative org links/includes Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-08-14  8:14  5% ` Philip Kaludercic
  2023-08-14 12:11  0%   ` Eli Zaretskii
  2023-08-15  1:57  4%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-19  9:46  5% ` Philip Kaludercic
  1 sibling, 2 replies; 200+ results
From: Philip Kaludercic @ 2023-08-14  8:14 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 65243

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Hello,
>
> This patch allows for relative includes and link in org files compiled
> to texinfo.
>
> Unfortunately, I missed this back in May
> (commit 1e6a7594 ), when we fixed relative texi @include links.
>
> I'm not sure how the Emacs release cycle works. Would it be possible to
> include this fix in 29.2?

I wouldn't have any issue with that, and AFAIU now that the release has
been cut, this should be fine, as this is just a bug fix.

BTW, what package is this related to?

> Best,
>
> Joseph
>
>>From e951b0ea4ffa90202ecee934eddd895b706c6794 Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Sat, 12 Aug 2023 01:40:07 -0700
> Subject: [PATCH] Fix building of VC package manuals with relative org
>  links/includes
>
> * lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
> Ensure that default-default is the docs-directory around
> org-export-to-file to ensure that links to relative files work correctly.
> ---
>  lisp/emacs-lisp/package-vc.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index b4c911015b5..ffc7afeb2ee 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -356,7 +356,8 @@ otherwise it's assumed to be an Info file."
>        (with-temp-buffer
>          (insert-file-contents file)
>          (setq file (make-temp-file "ox-texinfo-"))
> -        (org-export-to-file 'texinfo file)
> +        (let ((default-directory docs-directory))
> +          (org-export-to-file 'texinfo file))
>          (setq clean-up t)))
>      (with-current-buffer (get-buffer-create " *package-vc doc*")
>        (erase-buffer)





^ permalink raw reply	[relevance 5%]

* bug#65243: [PATCH] Fix building of VC package manuals with relative org links/includes
  2023-08-14  8:14  5% ` Philip Kaludercic
@ 2023-08-14 12:11  0%   ` Eli Zaretskii
  2023-08-15  1:57  4%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-08-14 12:11 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 65243, joseph

> Cc: 65243@debbugs.gnu.org
> From: Philip Kaludercic <philipk@posteo.net>
> Date: Mon, 14 Aug 2023 08:14:31 +0000
> 
> Joseph Turner <joseph@breatheoutbreathe.in> writes:
> 
> > I'm not sure how the Emacs release cycle works. Would it be possible to
> > include this fix in 29.2?
> 
> I wouldn't have any issue with that, and AFAIU now that the release has
> been cut, this should be fine, as this is just a bug fix.

Fine by me, thanks.





^ permalink raw reply	[relevance 0%]

* bug#65243: [PATCH] Fix building of VC package manuals with relative org links/includes
  2023-08-14  8:14  5% ` Philip Kaludercic
  2023-08-14 12:11  0%   ` Eli Zaretskii
@ 2023-08-15  1:57  4%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-15  1:57 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 65243


Philip Kaludercic <philipk@posteo.net> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Hello,
>>
>> This patch allows for relative includes and link in org files compiled
>> to texinfo.
>
> BTW, what package is this related to?

On my machine,

(package-vc-install '(hyperdrive
                      :url "https://git.sr.ht/~ushin/hyperdrive.el"
                      :doc "doc/hyperdrive-manual.org"))

gives the following backtrace:

Debugger entered--Lisp error: (error "Cannot include file /home/joseph/.emacs.d/elpa/hyperdrive/fdl.org")
  error("Cannot include file %s" "/home/joseph/.emacs.d/elpa/hyperdrive/fdl.org")
  org-export-expand-include-keyword()
  org-export-as(texinfo nil nil nil (:output-file "/tmp/ox-texinfo-hqSZfl"))
  org-export-to-file(texinfo "/tmp/ox-texinfo-hqSZfl")
  package-vc--build-documentation(#s(package-desc :name hyperdrive :version nil :summary "No description available." :reqs nil :kind vc :archive nil :dir "/home/joseph/.emacs.d/elpa/hyperdrive/" :extras nil :signed nil) "doc/hyperdrive-manual.org")
  package-vc--unpack-1(#s(package-desc :name hyperdrive :version nil :summary "No description available." :reqs nil :kind vc :archive nil :dir "/home/joseph/.emacs.d/elpa/hyperdrive/" :extras nil :signed nil) "/home/joseph/.emacs.d/elpa/hyperdrive/")
  package-vc--unpack(#s(package-desc :name hyperdrive :version nil :summary "No description available." :reqs nil :kind vc :archive nil :dir "/home/joseph/.emacs.d/elpa/hyperdrive/" :extras nil :signed nil) (:url "https://git.sr.ht/~ushin/hyperdrive.el" :doc "doc/hyperdrive-manual.org") nil)
  package-vc-install((hyperdrive :url "https://git.sr.ht/~ushin/hyperdrive.el" :doc "doc/hyperdrive-manual.org"))

"/home/joseph/.emacs.d/elpa/hyperdrive/fdl.org" does not exist, but
"/home/joseph/.emacs.d/elpa/hyperdrive/doc/fdl.org" does.

Hope this helps!

Joseph





^ permalink raw reply	[relevance 4%]

* bug#65243: [PATCH] Fix building of VC package manuals with relative org links/includes
  2023-08-12  8:43 10% bug#65243: [PATCH] Fix building of VC package manuals with relative org links/includes Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-14  8:14  5% ` Philip Kaludercic
@ 2023-08-19  9:46  5% ` Philip Kaludercic
  1 sibling, 0 replies; 200+ results
From: Philip Kaludercic @ 2023-08-19  9:46 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 65243-done

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Hello,
>
> This patch allows for relative includes and link in org files compiled
> to texinfo.
>
> Unfortunately, I missed this back in May
> (commit 1e6a7594 ), when we fixed relative texi @include links.
>
> I'm not sure how the Emacs release cycle works. Would it be possible to
> include this fix in 29.2?

I have applies the patch to emacs-29, and will close the report.  Thanks!

> Best,
>
> Joseph





^ permalink raw reply	[relevance 5%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
@ 2023-08-21  4:06  5% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-21 11:56  0% ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-21  4:06 UTC (permalink / raw)
  To: 65414; +Cc: jonas

Functions which are added to save-some-buffers-functions are always
called when save-some-buffers runs, even when a PRED argument is
specified. This leads to unexpected behavior when PRED is intended to
limit saving buffers to a specific set of file buffers, as in Magit's
magit-save-repository-buffers function.

abbrev--possibly-save is added to save-some-buffers-functions by default
now, so whenever magit-save-repository-buffers runs, Emacs prompts to
save unsaved abbrevs (as well any other functions in the list).

I propose that we pass along the PRED argument of save-some-buffers to
each of save-some-buffers-functions, allowing them to determine what is
appropriate to do. Alternatively, we could pass along the return value
of files--buffers-needing-to-be-saved, which is a list of buffers.

Thoughts?

Joseph





^ permalink raw reply	[relevance 5%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
  2023-08-21  4:06  5% bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-08-21 11:56  0% ` Eli Zaretskii
  2023-08-23 23:57  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-08-21 11:56 UTC (permalink / raw)
  To: Joseph Turner; +Cc: jonas, 65414

> Cc: jonas@bernoul.li
> Date: Sun, 20 Aug 2023 21:06:54 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Functions which are added to save-some-buffers-functions are always
> called when save-some-buffers runs, even when a PRED argument is
> specified. This leads to unexpected behavior when PRED is intended to
> limit saving buffers to a specific set of file buffers, as in Magit's
> magit-save-repository-buffers function.
> 
> abbrev--possibly-save is added to save-some-buffers-functions by default
> now, so whenever magit-save-repository-buffers runs, Emacs prompts to
> save unsaved abbrevs (as well any other functions in the list).

Why is asking whether to save the abbrevs a problem in the case of
magit-save-repository-buffers?

And are you saying that before the change which added
save-some-buffers-functions, Emacs was not saving the abbrevs when
save-some-buffers was called?  If so, in what Emacs version was this
so?

> I propose that we pass along the PRED argument of save-some-buffers to
> each of save-some-buffers-functions, allowing them to determine what is
> appropriate to do. Alternatively, we could pass along the return value
> of files--buffers-needing-to-be-saved, which is a list of buffers.

We need a better understanding of the situation before we can discuss
solutions, so please fill-in the blanks outlined above.  (The solution
you propose is not very backward-compatible, so probably not
acceptable anyway, as Emacs 29 was already released with the current
code.  But let's defer this discussion until the issue is more clear.)





^ permalink raw reply	[relevance 0%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
  2023-08-21 11:56  0% ` Eli Zaretskii
@ 2023-08-23 23:57  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-24  5:16  0%     ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-23 23:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: jonas, 65414


Eli Zaretskii <eliz@gnu.org> writes:

> Why is asking whether to save the abbrevs a problem in the case of
> magit-save-repository-buffers?

magit-save-repository-buffers docstring reads "Save file-visiting
buffers belonging to the current repository." IIUC, prompting to save
abbrevs here is an undesirable implementation side-effect.

Another example: hyperdrive.el adds to save-some-buffers-functions for
saving hyperdrive file buffers:

https://git.sr.ht/~ushin/hyperdrive.el/tree/d7dc7a08ba47761108cf98e21ffa2d8dad28f34a/item/hyperdrive.el#L99

After this change, magit-save-repository-buffers now prompts to save
irrelevant hyperdrive file buffers. I would like some way to tell
hyperdrive--save-some-buffers not to prompt the user to save hyperdrive
buffers from inside magit-save-repository-buffers.

> And are you saying that before the change which added
> save-some-buffers-functions, Emacs was not saving the abbrevs when
> save-some-buffers was called?  If so, in what Emacs version was this
> so?

The behavior of saving abbrevs when a PRED function is passed to
save-some-buffers has not changed in Emacs 29. I just think that there
may be room for improvement now that save-some-buffers-functions allows
any package to add to save-some-buffers-functions.

> We need a better understanding of the situation before we can discuss
> solutions, so please fill-in the blanks outlined above.

I hope the explanation above is clear. Sorry for starting off on the
wrong foot with an XY problem!

Thank you!

Joseph





^ permalink raw reply	[relevance 5%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
  2023-08-23 23:57  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-08-24  5:16  0%     ` Eli Zaretskii
  2023-08-26  6:38  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-08-24  5:16 UTC (permalink / raw)
  To: Joseph Turner; +Cc: jonas, 65414

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: 65414@debbugs.gnu.org, jonas@bernoul.li
> Date: Wed, 23 Aug 2023 16:57:06 -0700
> 
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Why is asking whether to save the abbrevs a problem in the case of
> > magit-save-repository-buffers?
> 
> magit-save-repository-buffers docstring reads "Save file-visiting
> buffers belonging to the current repository." IIUC, prompting to save
> abbrevs here is an undesirable implementation side-effect.

Why is it undesirable?  save-some-buffers always saved abbrevs, didn't
it?  And it did so independently of PRED, right?  So how did this
problem suddenly started affecting Magit?

IOW, I still don't have a clear idea what caused this problem, if
(AFAIU) it is a problem that started happening recently.

> Another example: hyperdrive.el adds to save-some-buffers-functions for
> saving hyperdrive file buffers:
> 
> https://git.sr.ht/~ushin/hyperdrive.el/tree/d7dc7a08ba47761108cf98e21ffa2d8dad28f34a/item/hyperdrive.el#L99
> 
> After this change, magit-save-repository-buffers now prompts to save
> irrelevant hyperdrive file buffers. I would like some way to tell
> hyperdrive--save-some-buffers not to prompt the user to save hyperdrive
> buffers from inside magit-save-repository-buffers.

Why do you want to do that?  Whether or not to prompt the user abides
by the common protocol defined by save-some-buffers: if it's called
with the argument ARG non-nil (which should happen interactively when
the user invokes the command with a prefix argument), there's no
prompt, otherwise Emacs prompts.  Why magit-save-repository-buffers
wants to break this common protocol?

I feel that I'm still missing something important, which causes you to
want a different behavior from magit-save-repository-buffers.  For
starters, can you describe how magit-save-repository-buffers ends up
calling save-some-buffers-functions in enough detail for me to
understand why you think saving these buffers is deemed "undesirable"?

> > And are you saying that before the change which added
> > save-some-buffers-functions, Emacs was not saving the abbrevs when
> > save-some-buffers was called?  If so, in what Emacs version was this
> > so?
> 
> The behavior of saving abbrevs when a PRED function is passed to
> save-some-buffers has not changed in Emacs 29. I just think that there
> may be room for improvement now that save-some-buffers-functions allows
> any package to add to save-some-buffers-functions.

We could try thinking about some backward-compatible change to the
save-some-buffers-functions feature, but a better understanding of the
issue is still needed.

Thanks.





^ permalink raw reply	[relevance 0%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
  2023-08-24  5:16  0%     ` Eli Zaretskii
@ 2023-08-26  6:38  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-26  7:26  0%         ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-26  6:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: jonas, 65414


Eli Zaretskii <eliz@gnu.org> writes:

>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Cc: 65414@debbugs.gnu.org, jonas@bernoul.li
>> Date: Wed, 23 Aug 2023 16:57:06 -0700
>>
>> magit-save-repository-buffers docstring reads "Save file-visiting
>> buffers belonging to the current repository." IIUC, prompting to save
>> abbrevs here is an undesirable implementation side-effect.
>
> Why is it undesirable?  save-some-buffers always saved abbrevs, didn't
> it?  And it did so independently of PRED, right?  So how did this
> problem suddenly started affecting Magit?
>
> IOW, I still don't have a clear idea what caused this problem, if
> (AFAIU) it is a problem that started happening recently.

This problem is not new. However, now that save-some-buffers-functions
has been added, the problem goes beyond abbrevs.

>> Another example: hyperdrive.el adds to save-some-buffers-functions for
>> saving hyperdrive file buffers:
>>
>> https://git.sr.ht/~ushin/hyperdrive.el/tree/d7dc7a08ba47761108cf98e21ffa2d8dad28f34a/item/hyperdrive.el#L99
>>
>> After this change, magit-save-repository-buffers now prompts to save
>> irrelevant hyperdrive file buffers. I would like some way to tell
>> hyperdrive--save-some-buffers not to prompt the user to save hyperdrive
>> buffers from inside magit-save-repository-buffers.
>
> Why do you want to do that?  Whether or not to prompt the user abides
> by the common protocol defined by save-some-buffers: if it's called
> with the argument ARG non-nil (which should happen interactively when
> the user invokes the command with a prefix argument), there's no
> prompt, otherwise Emacs prompts.  Why magit-save-repository-buffers
> wants to break this common protocol?

I think magit-save-repository-buffers follows the common protocol
correctly.

> I feel that I'm still missing something important, which causes you to
> want a different behavior from magit-save-repository-buffers.  For
> starters, can you describe how magit-save-repository-buffers ends up
> calling save-some-buffers-functions in enough detail for me to
> understand why you think saving these buffers is deemed "undesirable"?

The issue is not that save-some-buffers prompts instead of saving
without questions.

What is undesirable to me is that save-some-buffers unconditionally
calls each one of save-some-buffers-functions, regardless of PRED. This
means that when save-some-buffers is used with the intention to save
only a handful of files (as with magit-save-repository-buffers),
save-some-buffers-functions are all called, even when irrelevant.

Thanks again for your patience :)

Joseph





^ permalink raw reply	[relevance 5%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
  2023-08-26  6:38  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-08-26  7:26  0%         ` Eli Zaretskii
  2023-08-26  7:32 10%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-08-26  7:26 UTC (permalink / raw)
  To: Joseph Turner; +Cc: jonas, 65414

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: 65414@debbugs.gnu.org, jonas@bernoul.li
> Date: Fri, 25 Aug 2023 23:38:18 -0700
> 
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Why is it undesirable?  save-some-buffers always saved abbrevs, didn't
> > it?  And it did so independently of PRED, right?  So how did this
> > problem suddenly started affecting Magit?
> >
> > IOW, I still don't have a clear idea what caused this problem, if
> > (AFAIU) it is a problem that started happening recently.
> 
> This problem is not new. However, now that save-some-buffers-functions
> has been added, the problem goes beyond abbrevs.
> 
> >> Another example: hyperdrive.el adds to save-some-buffers-functions for
> >> saving hyperdrive file buffers:
> >>
> >> https://git.sr.ht/~ushin/hyperdrive.el/tree/d7dc7a08ba47761108cf98e21ffa2d8dad28f34a/item/hyperdrive.el#L99
> >>
> >> After this change, magit-save-repository-buffers now prompts to save
> >> irrelevant hyperdrive file buffers. I would like some way to tell
> >> hyperdrive--save-some-buffers not to prompt the user to save hyperdrive
> >> buffers from inside magit-save-repository-buffers.
> >
> > Why do you want to do that?  Whether or not to prompt the user abides
> > by the common protocol defined by save-some-buffers: if it's called
> > with the argument ARG non-nil (which should happen interactively when
> > the user invokes the command with a prefix argument), there's no
> > prompt, otherwise Emacs prompts.  Why magit-save-repository-buffers
> > wants to break this common protocol?
> 
> I think magit-save-repository-buffers follows the common protocol
> correctly.
> 
> > I feel that I'm still missing something important, which causes you to
> > want a different behavior from magit-save-repository-buffers.  For
> > starters, can you describe how magit-save-repository-buffers ends up
> > calling save-some-buffers-functions in enough detail for me to
> > understand why you think saving these buffers is deemed "undesirable"?
> 
> The issue is not that save-some-buffers prompts instead of saving
> without questions.
> 
> What is undesirable to me is that save-some-buffers unconditionally
> calls each one of save-some-buffers-functions, regardless of PRED. This
> means that when save-some-buffers is used with the intention to save
> only a handful of files (as with magit-save-repository-buffers),
> save-some-buffers-functions are all called, even when irrelevant.

So your problem is with Lisp programs that add functions to
save-some-buffers-functions, but don't expect or don't want those
functions to be called each time save-some-buffers is invoked?

I'm not sure how did those Lisp programs get the idea that
save-some-buffers-functions will not be called always -- is it hinted
by some documentation somewhere?  If not, I'd say that those Lisp
programs have a bug that needs to be fixed in those programs.  Right?

In any case, not calling save-some-buffers-functions when PRED is
non-nil is not something we can do, as that would be an incompatible
behavior change.  We could perhaps add PRED to the arguments with
which save-some-buffers-functions are called, as an optional argument.
Would that be satisfactory?





^ permalink raw reply	[relevance 0%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
  2023-08-26  7:26  0%         ` Eli Zaretskii
@ 2023-08-26  7:32 10%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-02  7:30  0%             ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-26  7:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: jonas, 65414

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:
> So your problem is with Lisp programs that add functions to
> save-some-buffers-functions, but don't expect or don't want those
> functions to be called each time save-some-buffers is invoked?

Yes.

> I'm not sure how did those Lisp programs get the idea that
> save-some-buffers-functions will not be called always -- is it hinted
> by some documentation somewhere?  If not, I'd say that those Lisp
> programs have a bug that needs to be fixed in those programs.  Right?

I agree.

> In any case, not calling save-some-buffers-functions when PRED is
> non-nil is not something we can do, as that would be an incompatible
> behavior change.  We could perhaps add PRED to the arguments with
> which save-some-buffers-functions are called, as an optional argument.
> Would that be satisfactory?

Yes, that would solve the interference between Magit and hyperdrive.el.

See patch.

Thank you!

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Pass-PRED-to-each-of-save-some-buffers-functions.patch --]
[-- Type: text/x-diff, Size: 2175 bytes --]

From 28e8745b579da5f83afc7f9eb5b5ed2df2f3204e Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 26 Aug 2023 00:50:28 -0700
Subject: [PATCH] Pass PRED to each of save-some-buffers-functions

* lisp/abbrev.el (abbrev--possibly-save): Ignore PRED
* lisp/files.el (save-some-buffers-functions): Fix documentation
(save-some-buffers): Pass PRED to each of save-some-buffers-functions
---
 lisp/abbrev.el | 2 +-
 lisp/files.el  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index e1311dbc83b..43e7c7e5e5d 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -1242,7 +1242,7 @@ which see."
               '(edit-abbrevs-mode-font-lock-keywords nil nil ((?_ . "w"))))
   (setq font-lock-multiline nil))
 
-(defun abbrev--possibly-save (query &optional arg)
+(defun abbrev--possibly-save (query &optional arg _pred)
   ;; Query mode.
   (if (eq query 'query)
       (and save-abbrevs abbrevs-changed)
diff --git a/lisp/files.el b/lisp/files.el
index 29d109ab385..6ab10cc3310 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6003,8 +6003,8 @@ function should return non-nil if there is something to be
 saved (but it should not actually save anything).
 
 If the first argument is something else, then the function should
-save according to the value of the second argument, which is the
-ARG argument from `save-some-buffers'.")
+save according to the values of the second and third arguments,
+which are the ARG and PRED arguments from `save-some-buffers'.")
 
 (defun save-some-buffers (&optional arg pred)
   "Save some modified file-visiting buffers.  Asks user about each one.
@@ -6099,7 +6099,7 @@ after saving the buffers."
 	         save-some-buffers-action-alist))
           ;; Allow other things to be saved at this time, like abbrevs.
           (dolist (func save-some-buffers-functions)
-            (setq inhibit-message (or (funcall func nil arg) inhibit-message)))
+            (setq inhibit-message (or (funcall func nil arg pred) inhibit-message)))
           (or queried (> files-done 0) inhibit-message
 	      (cond
 	       ((null autosaved-buffers)
-- 
2.41.0


^ permalink raw reply related	[relevance 10%]

* bug#65608: Fwd: [PATCH] project.el: Use list of strings p for safe local variable
       [not found]     <87r0nqct63.fsf@breatheoutbreathe.in>
@ 2023-08-30  7:10 11% ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-30 11:22  5%   ` Dmitry Gutov
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-30  7:10 UTC (permalink / raw)
  To: 65608; +Cc: dmitry, stefankangas

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

Stefan Kangas suggested I resend this patch to this mailing list so that
it's not lost even though it can't be applied yet.

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Might make sense to merge this into 29.2?
>
> [2. text/x-diff; 0001-project.el-Use-list-of-strings-p-for-safe-local-vari.patch]...


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-project.el-Use-list-of-strings-p-for-safe-local-vari.patch --]
[-- Type: text/x-diff, Size: 1587 bytes --]

From 8237eb21c81b3e5ededd42a3a2d5b9770d45ca92 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Fri, 25 Aug 2023 21:31:06 -0700
Subject: [PATCH] project.el: Use list-of-strings-p for safe-local-variable
 predicate

* lisp/progmodes/project.el (project-vc-ignores)
(project-vc-extra-root-markers)
---
 lisp/progmodes/project.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 8d8bf594628..882173a65d0 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -397,7 +397,7 @@ the buffer's value of `default-directory'."
 (defcustom project-vc-ignores nil
   "List of patterns to add to `project-ignores'."
   :type '(repeat string))
-;;;###autoload(put 'project-vc-ignores 'safe-local-variable #'listp)
+;;;###autoload(put 'project-vc-ignores 'safe-local-variable #'list-of-strings-p)
 
 (defcustom project-vc-merge-submodules t
   "Non-nil to consider submodules part of the parent project.
@@ -452,7 +452,7 @@ variables, such as `project-vc-ignores' or `project-vc-name'."
   :type '(repeat string)
   :version "29.1"
   :package-version '(project . "0.9.0"))
-;;;###autoload(put 'project-vc-extra-root-markers 'safe-local-variable (lambda (val) (and (listp val) (not (memq nil (mapcar #'stringp val))))))
+;;;###autoload(put 'project-vc-extra-root-markers 'safe-local-variable #'list-of-strings-p)
 
 ;; FIXME: Using the current approach, major modes are supposed to set
 ;; this variable to a buffer-local value.  So we don't have access to
-- 
2.41.0


^ permalink raw reply related	[relevance 11%]

* bug#65608: Fwd: [PATCH] project.el: Use list of strings p for safe local variable
  2023-08-30  7:10 11% ` bug#65608: Fwd: [PATCH] project.el: Use list of strings p for safe local variable Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-08-30 11:22  5%   ` Dmitry Gutov
  2023-08-30 17:54  0%     ` Stefan Kangas
  0 siblings, 1 reply; 200+ results
From: Dmitry Gutov @ 2023-08-30 11:22 UTC (permalink / raw)
  To: Joseph Turner, 65608; +Cc: stefankangas

On 30/08/2023 10:10, Joseph Turner via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> Stefan Kangas suggested I resend this patch to this mailing list so that
> it's not lost even though it can't be applied yet.

Just to clarify for posterity: it can't be applied yet because 
list-of-string-p is not in Emacs 26. Or 27 (which we might bump the 
requirement to in not-too-distant future).





^ permalink raw reply	[relevance 5%]

* bug#65608: Fwd: [PATCH] project.el: Use list of strings p for safe local variable
  2023-08-30 11:22  5%   ` Dmitry Gutov
@ 2023-08-30 17:54  0%     ` Stefan Kangas
  0 siblings, 0 replies; 200+ results
From: Stefan Kangas @ 2023-08-30 17:54 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 65608-done, Joseph Turner

Version: 30.1

Dmitry Gutov <dmitry@gutov.dev> writes:

> On 30/08/2023 10:10, Joseph Turner via Bug reports for GNU Emacs, the
> Swiss army knife of text editors wrote:
> > Stefan Kangas suggested I resend this patch to this mailing list so that
> > it's not lost even though it can't be applied yet.
>
> Just to clarify for posterity: it can't be applied yet because
> list-of-string-p is not in Emacs 26. Or 27 (which we might bump the
> requirement to in not-too-distant future).

Right.  Note that `list-of-strings-p' was added in Emacs 28, though.
So I added a comment to that effect in commit 9647ddb2993, and I'm
closing the bug.





^ permalink raw reply	[relevance 0%]

* bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails
@ 2023-08-31  6:26  9% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-31  6:32  9% ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-31  6:50  0% ` Eli Zaretskii
  0 siblings, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-31  6:26 UTC (permalink / raw)
  To: 65649; +Cc: Philip Kaludercic

[-- Attachment #1: Type: text/plain, Size: 180 bytes --]

In light of the recent fix regarding building documentation from
org-mode files, I think it makes sense to ensure that installation
continues even without documentation.

Joseph



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Continue-installing-package-when-documentation-build.patch --]
[-- Type: text/x-diff, Size: 3691 bytes --]

From 83c62d80b5199cee911e30c1f3bb03c5a585b689 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Wed, 30 Aug 2023 23:24:16 -0700
Subject: [PATCH] Continue installing package when documentation building fails

* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
Demote errors to messages.
---
 lisp/emacs-lisp/package-vc.el | 61 ++++++++++++++++++-----------------
 1 file changed, 31 insertions(+), 30 deletions(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 747fe696204..bc1200c583f 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -409,36 +409,37 @@ prepared."
   "Build documentation for package PKG-DESC from documentation source in FILE.
 FILE can be an Org file, indicated by its \".org\" extension,
 otherwise it's assumed to be an Info file."
-  (let* ((pkg-name (package-desc-name pkg-desc))
-         (default-directory (package-desc-dir pkg-desc))
-         (docs-directory (file-name-directory (expand-file-name file)))
-         (output (expand-file-name (format "%s.info" pkg-name)))
-         clean-up)
-    (when (string-match-p "\\.org\\'" file)
-      (require 'ox)
-      (require 'ox-texinfo)
-      (with-temp-buffer
-        (insert-file-contents file)
-        (setq file (make-temp-file "ox-texinfo-"))
-        (let ((default-directory docs-directory))
-          (org-export-to-file 'texinfo file))
-        (setq clean-up t)))
-    (with-current-buffer (get-buffer-create " *package-vc doc*")
-      (erase-buffer)
-      (cond
-       ((/= 0 (call-process "makeinfo" nil t nil
-                            "-I" docs-directory
-                            "--no-split" file
-                            "-o" output))
-        (message "Failed to build manual %s, see buffer %S"
-                 file (buffer-name)))
-       ((/= 0 (call-process "install-info" nil t nil
-                            output (expand-file-name "dir")))
-        (message "Failed to install manual %s, see buffer %S"
-                 output (buffer-name)))
-       ((kill-buffer))))
-    (when clean-up
-      (delete-file file))))
+  (with-demoted-errors "package-vc: Could not build documentation: %s"
+    (let* ((pkg-name (package-desc-name pkg-desc))
+           (default-directory (package-desc-dir pkg-desc))
+           (docs-directory (file-name-directory (expand-file-name file)))
+           (output (expand-file-name (format "%s.info" pkg-name)))
+           clean-up)
+      (when (string-match-p "\\.org\\'" file)
+        (require 'ox)
+        (require 'ox-texinfo)
+        (with-temp-buffer
+          (insert-file-contents file)
+          (setq file (make-temp-file "ox-texinfo-"))
+          (let ((default-directory docs-directory))
+            (org-export-to-file 'texinfo file))
+          (setq clean-up t)))
+      (with-current-buffer (get-buffer-create " *package-vc doc*")
+        (erase-buffer)
+        (cond
+         ((/= 0 (call-process "makeinfo" nil t nil
+                              "-I" docs-directory
+                              "--no-split" file
+                              "-o" output))
+          (message "Failed to build manual %s, see buffer %S"
+                   file (buffer-name)))
+         ((/= 0 (call-process "install-info" nil t nil
+                              output (expand-file-name "dir")))
+          (message "Failed to install manual %s, see buffer %S"
+                   output (buffer-name)))
+         ((kill-buffer))))
+      (when clean-up
+        (delete-file file)))))
 
 (defun package-vc-install-dependencies (deps)
   "Install missing dependencies according to DEPS.
-- 
2.41.0


^ permalink raw reply related	[relevance 9%]

* bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails
  2023-08-31  6:26  9% bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-08-31  6:32  9% ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-31  6:34 11%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-31  6:50  0% ` Eli Zaretskii
  1 sibling, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-31  6:32 UTC (permalink / raw)
  To: 65649, philipk

[-- Attachment #1: Type: text/plain, Size: 46 bytes --]

Oops, the format string should be %S, not %s.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Continue-installing-package-when-documentation-build.patch --]
[-- Type: text/x-diff, Size: 3691 bytes --]

From 83c62d80b5199cee911e30c1f3bb03c5a585b689 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Wed, 30 Aug 2023 23:24:16 -0700
Subject: [PATCH] Continue installing package when documentation building fails

* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
Demote errors to messages.
---
 lisp/emacs-lisp/package-vc.el | 61 ++++++++++++++++++-----------------
 1 file changed, 31 insertions(+), 30 deletions(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 747fe696204..bc1200c583f 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -409,36 +409,37 @@ prepared."
   "Build documentation for package PKG-DESC from documentation source in FILE.
 FILE can be an Org file, indicated by its \".org\" extension,
 otherwise it's assumed to be an Info file."
-  (let* ((pkg-name (package-desc-name pkg-desc))
-         (default-directory (package-desc-dir pkg-desc))
-         (docs-directory (file-name-directory (expand-file-name file)))
-         (output (expand-file-name (format "%s.info" pkg-name)))
-         clean-up)
-    (when (string-match-p "\\.org\\'" file)
-      (require 'ox)
-      (require 'ox-texinfo)
-      (with-temp-buffer
-        (insert-file-contents file)
-        (setq file (make-temp-file "ox-texinfo-"))
-        (let ((default-directory docs-directory))
-          (org-export-to-file 'texinfo file))
-        (setq clean-up t)))
-    (with-current-buffer (get-buffer-create " *package-vc doc*")
-      (erase-buffer)
-      (cond
-       ((/= 0 (call-process "makeinfo" nil t nil
-                            "-I" docs-directory
-                            "--no-split" file
-                            "-o" output))
-        (message "Failed to build manual %s, see buffer %S"
-                 file (buffer-name)))
-       ((/= 0 (call-process "install-info" nil t nil
-                            output (expand-file-name "dir")))
-        (message "Failed to install manual %s, see buffer %S"
-                 output (buffer-name)))
-       ((kill-buffer))))
-    (when clean-up
-      (delete-file file))))
+  (with-demoted-errors "package-vc: Could not build documentation: %S"
+    (let* ((pkg-name (package-desc-name pkg-desc))
+           (default-directory (package-desc-dir pkg-desc))
+           (docs-directory (file-name-directory (expand-file-name file)))
+           (output (expand-file-name (format "%s.info" pkg-name)))
+           clean-up)
+      (when (string-match-p "\\.org\\'" file)
+        (require 'ox)
+        (require 'ox-texinfo)
+        (with-temp-buffer
+          (insert-file-contents file)
+          (setq file (make-temp-file "ox-texinfo-"))
+          (let ((default-directory docs-directory))
+            (org-export-to-file 'texinfo file))
+          (setq clean-up t)))
+      (with-current-buffer (get-buffer-create " *package-vc doc*")
+        (erase-buffer)
+        (cond
+         ((/= 0 (call-process "makeinfo" nil t nil
+                              "-I" docs-directory
+                              "--no-split" file
+                              "-o" output))
+          (message "Failed to build manual %s, see buffer %S"
+                   file (buffer-name)))
+         ((/= 0 (call-process "install-info" nil t nil
+                              output (expand-file-name "dir")))
+          (message "Failed to install manual %s, see buffer %S"
+                   output (buffer-name)))
+         ((kill-buffer))))
+      (when clean-up
+        (delete-file file)))))
 
 (defun package-vc-install-dependencies (deps)
   "Install missing dependencies according to DEPS.
-- 
2.41.0


^ permalink raw reply related	[relevance 9%]

* bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails
  2023-08-31  6:32  9% ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-08-31  6:34 11%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-31  7:18  5%     ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-31  6:34 UTC (permalink / raw)
  To: 65649, philipk

It would be nice to report more information about the package with failed
documentation, but AFAICT with-demoted-errors does not allow its FORMAT
string to be a symbol whose value is a string.

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Oops, the format string should be %S, not %s.
>
> [2. text/x-diff; 0001-Continue-installing-package-when-documentation-build.patch]
> From 83c62d80b5199cee911e30c1f3bb03c5a585b689 Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Wed, 30 Aug 2023 23:24:16 -0700
> Subject: [PATCH] Continue installing package when documentation building fails
>
> * lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
> Demote errors to messages.
> ---
>  lisp/emacs-lisp/package-vc.el | 61 ++++++++++++++++++-----------------
>  1 file changed, 31 insertions(+), 30 deletions(-)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index 747fe696204..bc1200c583f 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -409,36 +409,37 @@ prepared."
>    "Build documentation for package PKG-DESC from documentation source in FILE.
>  FILE can be an Org file, indicated by its \".org\" extension,
>  otherwise it's assumed to be an Info file."
> -  (let* ((pkg-name (package-desc-name pkg-desc))
> -         (default-directory (package-desc-dir pkg-desc))
> -         (docs-directory (file-name-directory (expand-file-name file)))
> -         (output (expand-file-name (format "%s.info" pkg-name)))
> -         clean-up)
> -    (when (string-match-p "\\.org\\'" file)
> -      (require 'ox)
> -      (require 'ox-texinfo)
> -      (with-temp-buffer
> -        (insert-file-contents file)
> -        (setq file (make-temp-file "ox-texinfo-"))
> -        (let ((default-directory docs-directory))
> -          (org-export-to-file 'texinfo file))
> -        (setq clean-up t)))
> -    (with-current-buffer (get-buffer-create " *package-vc doc*")
> -      (erase-buffer)
> -      (cond
> -       ((/= 0 (call-process "makeinfo" nil t nil
> -                            "-I" docs-directory
> -                            "--no-split" file
> -                            "-o" output))
> -        (message "Failed to build manual %s, see buffer %S"
> -                 file (buffer-name)))
> -       ((/= 0 (call-process "install-info" nil t nil
> -                            output (expand-file-name "dir")))
> -        (message "Failed to install manual %s, see buffer %S"
> -                 output (buffer-name)))
> -       ((kill-buffer))))
> -    (when clean-up
> -      (delete-file file))))
> +  (with-demoted-errors "package-vc: Could not build documentation: %S"
> +    (let* ((pkg-name (package-desc-name pkg-desc))
> +           (default-directory (package-desc-dir pkg-desc))
> +           (docs-directory (file-name-directory (expand-file-name file)))
> +           (output (expand-file-name (format "%s.info" pkg-name)))
> +           clean-up)
> +      (when (string-match-p "\\.org\\'" file)
> +        (require 'ox)
> +        (require 'ox-texinfo)
> +        (with-temp-buffer
> +          (insert-file-contents file)
> +          (setq file (make-temp-file "ox-texinfo-"))
> +          (let ((default-directory docs-directory))
> +            (org-export-to-file 'texinfo file))
> +          (setq clean-up t)))
> +      (with-current-buffer (get-buffer-create " *package-vc doc*")
> +        (erase-buffer)
> +        (cond
> +         ((/= 0 (call-process "makeinfo" nil t nil
> +                              "-I" docs-directory
> +                              "--no-split" file
> +                              "-o" output))
> +          (message "Failed to build manual %s, see buffer %S"
> +                   file (buffer-name)))
> +         ((/= 0 (call-process "install-info" nil t nil
> +                              output (expand-file-name "dir")))
> +          (message "Failed to install manual %s, see buffer %S"
> +                   output (buffer-name)))
> +         ((kill-buffer))))
> +      (when clean-up
> +        (delete-file file)))))
>
>  (defun package-vc-install-dependencies (deps)
>    "Install missing dependencies according to DEPS.






^ permalink raw reply	[relevance 11%]

* bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails
  2023-08-31  6:26  9% bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-31  6:32  9% ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-08-31  6:50  0% ` Eli Zaretskii
  1 sibling, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-08-31  6:50 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 65649, philipk

> Cc: Philip Kaludercic <philipk@posteo.net>
> Date: Wed, 30 Aug 2023 23:26:35 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> In light of the recent fix regarding building documentation from
> org-mode files, I think it makes sense to ensure that installation
> continues even without documentation.

I don't think we should do this silently.  The user should be asked
to confirm, at the very least.





^ permalink raw reply	[relevance 0%]

* bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails
  2023-08-31  6:34 11%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-08-31  7:18  5%     ` Philip Kaludercic
  2023-08-31 21:19  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-08-31  7:18 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 65649

Btw, watch out when reporting a bug, you shouldn't CC people directly,
but add a X-Debbugs-CC header
(https://debbugs.gnu.org/Reporting.html#xcc), as otherwise I'd be
creating a new bug report when responding to your message.

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> It would be nice to report more information about the package with failed
> documentation, but AFAICT with-demoted-errors does not allow its FORMAT
> string to be a symbol whose value is a string.

What are the main errors we are concerned with?  I am a bit concerned
that `with-demoted-errors' is a too coarse approach and might be applied
to widely in your current patch.  It might be better to use a classical
condition-case and handle the right errors in the right place, or if
practicable try to detect if an error would occur before doing anything.

Also, the buffer *package-vc doc* should stay persistent and would
include error messages, that could also be used here.

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Oops, the format string should be %S, not %s.
>>
>> [2. text/x-diff; 0001-Continue-installing-package-when-documentation-build.patch]
>> From 83c62d80b5199cee911e30c1f3bb03c5a585b689 Mon Sep 17 00:00:00 2001
>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Date: Wed, 30 Aug 2023 23:24:16 -0700
>> Subject: [PATCH] Continue installing package when documentation building fails
>>
>> * lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
>> Demote errors to messages.
>> ---
>>  lisp/emacs-lisp/package-vc.el | 61 ++++++++++++++++++-----------------
>>  1 file changed, 31 insertions(+), 30 deletions(-)
>>
>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>> index 747fe696204..bc1200c583f 100644
>> --- a/lisp/emacs-lisp/package-vc.el
>> +++ b/lisp/emacs-lisp/package-vc.el
>> @@ -409,36 +409,37 @@ prepared."
>>    "Build documentation for package PKG-DESC from documentation source in FILE.
>>  FILE can be an Org file, indicated by its \".org\" extension,
>>  otherwise it's assumed to be an Info file."
>> -  (let* ((pkg-name (package-desc-name pkg-desc))
>> -         (default-directory (package-desc-dir pkg-desc))
>> -         (docs-directory (file-name-directory (expand-file-name file)))
>> -         (output (expand-file-name (format "%s.info" pkg-name)))
>> -         clean-up)
>> -    (when (string-match-p "\\.org\\'" file)
>> -      (require 'ox)
>> -      (require 'ox-texinfo)
>> -      (with-temp-buffer
>> -        (insert-file-contents file)
>> -        (setq file (make-temp-file "ox-texinfo-"))
>> -        (let ((default-directory docs-directory))
>> -          (org-export-to-file 'texinfo file))
>> -        (setq clean-up t)))
>> -    (with-current-buffer (get-buffer-create " *package-vc doc*")
>> -      (erase-buffer)
>> -      (cond
>> -       ((/= 0 (call-process "makeinfo" nil t nil
>> -                            "-I" docs-directory
>> -                            "--no-split" file
>> -                            "-o" output))
>> -        (message "Failed to build manual %s, see buffer %S"
>> -                 file (buffer-name)))
>> -       ((/= 0 (call-process "install-info" nil t nil
>> -                            output (expand-file-name "dir")))
>> -        (message "Failed to install manual %s, see buffer %S"
>> -                 output (buffer-name)))
>> -       ((kill-buffer))))
>> -    (when clean-up
>> -      (delete-file file))))
>> +  (with-demoted-errors "package-vc: Could not build documentation: %S"
>> +    (let* ((pkg-name (package-desc-name pkg-desc))
>> +           (default-directory (package-desc-dir pkg-desc))
>> +           (docs-directory (file-name-directory (expand-file-name file)))
>> +           (output (expand-file-name (format "%s.info" pkg-name)))
>> +           clean-up)
>> +      (when (string-match-p "\\.org\\'" file)
>> +        (require 'ox)
>> +        (require 'ox-texinfo)
>> +        (with-temp-buffer
>> +          (insert-file-contents file)
>> +          (setq file (make-temp-file "ox-texinfo-"))
>> +          (let ((default-directory docs-directory))
>> +            (org-export-to-file 'texinfo file))
>> +          (setq clean-up t)))
>> +      (with-current-buffer (get-buffer-create " *package-vc doc*")
>> +        (erase-buffer)
>> +        (cond
>> +         ((/= 0 (call-process "makeinfo" nil t nil
>> +                              "-I" docs-directory
>> +                              "--no-split" file
>> +                              "-o" output))
>> +          (message "Failed to build manual %s, see buffer %S"
>> +                   file (buffer-name)))
>> +         ((/= 0 (call-process "install-info" nil t nil
>> +                              output (expand-file-name "dir")))
>> +          (message "Failed to install manual %s, see buffer %S"
>> +                   output (buffer-name)))
>> +         ((kill-buffer))))
>> +      (when clean-up
>> +        (delete-file file)))))
>>
>>  (defun package-vc-install-dependencies (deps)
>>    "Install missing dependencies according to DEPS.





^ permalink raw reply	[relevance 5%]

* bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails
  2023-08-31  7:18  5%     ` Philip Kaludercic
@ 2023-08-31 21:19  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-31 21:39 11%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-01 13:14  7%         ` Philip Kaludercic
  0 siblings, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-31 21:19 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 65649


Philip Kaludercic <philipk@posteo.net> writes:

> Btw, watch out when reporting a bug, you shouldn't CC people directly,
> but add a X-Debbugs-CC header
> (https://debbugs.gnu.org/Reporting.html#xcc), as otherwise I'd be
> creating a new bug report when responding to your message.

Good to know! Thank you! Is it okay to CC people when responding to a
bug report email (e.g. if I CC'd Eli in this email)?

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> It would be nice to report more information about the package with failed
>> documentation, but AFAICT with-demoted-errors does not allow its FORMAT
>> string to be a symbol whose value is a string.
>
> What are the main errors we are concerned with?  I am a bit concerned
> that `with-demoted-errors' is a too coarse approach and might be applied
> to widely in your current patch.  It might be better to use a classical
> condition-case and handle the right errors in the right place, or if
> practicable try to detect if an error would occur before doing anything.

I don't know what kinds of errors to expect, which is why I went with
the coarse approach.  Under what circumstances would we want to stop
package installation entirely when documentation can't be built?

> Also, the buffer *package-vc doc* should stay persistent and would
> include error messages, that could also be used here.

Like this?

(with-demoted-errors "package-vc: Could not build documentation. See *package-vc doc* for details" ... )





^ permalink raw reply	[relevance 5%]

* bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails
  2023-08-31 21:19  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-08-31 21:39 11%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-01 13:14  7%         ` Philip Kaludercic
  1 sibling, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-31 21:39 UTC (permalink / raw)
  To: Philip Kaludercic, 65649


Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Also, the buffer *package-vc doc* should stay persistent and would
>> include error messages, that could also be used here.
>
> Like this?
>
> (with-demoted-errors "package-vc: Could not build documentation. See *package-vc doc* for details" ... )

Actually, that would not have handled the error related to relative org
#+include statements, since that error happened above this line:

(with-current-buffer (get-buffer-create " *package-vc doc*")





^ permalink raw reply	[relevance 11%]

* bug#65666: Lockfiles break package-vc-install-from-checkout
@ 2023-08-31 21:47  4% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-01  5:50  0% ` Eli Zaretskii
  2023-09-01  6:18  5% ` joseph--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-31 21:47 UTC (permalink / raw)
  To: 65666; +Cc: Philip Kaludercic, Adam Porter

To reproduce: clone a repo, ensure that create-lockfiles is non-nil,
edit a source file in the repo but do not save it, run
package-vc-install-from-checkout on the repo.

Backtrace:

Debugger entered--Lisp error: (file-missing "/home/joseph/.emacs.d/elpa/hyperdrive/.#hyperdrive.el")
  comp-el-to-eln-filename("/home/joseph/.emacs.d/elpa/hyperdrive/.#hyperdrive.el")
  (comp-clean-up-stale-eln (comp-el-to-eln-filename file))
  (while (consp --cl-var--) (setq file (car --cl-var--)) (comp-clean-up-stale-eln (comp-el-to-eln-filename file)) (setq --cl-var-- (cdr --cl-var--)))
  (let* ((--cl-var-- (directory-files-recursively dir "\\.el\\'")) (file nil)) (while (consp --cl-var--) (setq file (car --cl-var--)) (comp-clean-up-stale-eln (comp-el-to-eln-filename file)) (setq --cl-var-- (cdr --cl-var--))) nil)
  (progn (let* ((--cl-var-- (directory-files-recursively dir "\\.el\\'")) (file nil)) (while (consp --cl-var--) (setq file (car --cl-var--)) (comp-clean-up-stale-eln (comp-el-to-eln-filename file)) (setq --cl-var-- (cdr --cl-var--))) nil))
  (if (featurep 'native-compile) (progn (let* ((--cl-var-- (directory-files-recursively dir "\\.el\\'")) (file nil)) (while (consp --cl-var--) (setq file (car --cl-var--)) (comp-clean-up-stale-eln (comp-el-to-eln-filename file)) (setq --cl-var-- (cdr --cl-var--))) nil)))
  package--delete-directory("/home/joseph/.emacs.d/elpa/hyperdrive")
  package-vc-install-from-checkout("~/.local/src/hyperdrive.el/" "hyperdrive")
  funcall-interactively(package-vc-install-from-checkout "~/.local/src/hyperdrive.el/" "hyperdrive")
  command-execute(package-vc-install-from-checkout record)
  execute-extended-command(nil "package-vc-install-from-checkout" nil)
  funcall-interactively(execute-extended-command nil "package-vc-install-from-checkout" nil)
  command-execute(execute-extended-command)





^ permalink raw reply	[relevance 4%]

* bug#65666: Lockfiles break package-vc-install-from-checkout
  2023-08-31 21:47  4% bug#65666: Lockfiles break package-vc-install-from-checkout Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-01  5:50  0% ` Eli Zaretskii
  2023-09-01  6:18  5% ` joseph--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-09-01  5:50 UTC (permalink / raw)
  To: Joseph Turner; +Cc: adam.porter, philipk, 65666

> Cc: Philip Kaludercic <philipk@posteo.net>, Adam Porter <adam.porter@47ap.net>
> Date: Thu, 31 Aug 2023 14:47:48 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> To reproduce: clone a repo, ensure that create-lockfiles is non-nil,
> edit a source file in the repo but do not save it, run
> package-vc-install-from-checkout on the repo.
> 
> Backtrace:
> 
> Debugger entered--Lisp error: (file-missing "/home/joseph/.emacs.d/elpa/hyperdrive/.#hyperdrive.el")
>   comp-el-to-eln-filename("/home/joseph/.emacs.d/elpa/hyperdrive/.#hyperdrive.el")

We should not try to native-compile lock files, obviously.  Some code
naïvely uses "*.el" to find all the Lisp files; it should filter out
lock files.

P.S. Please always say in what version of Emacs you see the problem
you report.  Bonus points for including all of the information
collected by report-emacs-bug about your system and Emacs
configurations.





^ permalink raw reply	[relevance 0%]

* bug#65666: Lockfiles break package-vc-install-from-checkout
  2023-08-31 21:47  4% bug#65666: Lockfiles break package-vc-install-from-checkout Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-01  5:50  0% ` Eli Zaretskii
@ 2023-09-01  6:18  5% ` joseph--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-01 12:52  0%   ` Philip Kaludercic
  1 sibling, 1 reply; 200+ results
From: joseph--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-01  6:18 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: adam.porter, philipk, 65666

[-- Attachment #1: Type: text/plain, Size: 515 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:
> We should not try to native-compile lock files, obviously.  Some code
> naïvely uses "*.el" to find all the Lisp files; it should filter out
> lock files.

Please see attached patch.

> P.S. Please always say in what version of Emacs you see the problem
> you report.  Bonus points for including all of the information
> collected by report-emacs-bug about your system and Emacs
> configurations.

Thanks - I'm on 29.0.92. I'll include that information next time.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Don-t-native-compile-lock-files.patch --]
[-- Type: text/x-diff; name="0001-Don-t-native-compile-lock-files.patch", Size: 912 bytes --]

From 7b38b0bfd8c9da08daf734f6d0062d31dd54b947 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Thu, 31 Aug 2023 23:11:53 -0700
Subject: [PATCH] Don't native compile lock files

* lisp/emacs-lisp/package.el (package--delete-directory):
Check that each file exists before compiling.
---
 lisp/emacs-lisp/package.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index e1172d69bf0..52a538e0627 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2485,6 +2485,7 @@ compiled."
   (when (featurep 'native-compile)
     (cl-loop
      for file in (directory-files-recursively dir "\\.el\\'")
+     when (file-exists-p file)
      do (comp-clean-up-stale-eln (comp-el-to-eln-filename file))))
   (if (file-symlink-p (directory-file-name dir))
       (delete-file (directory-file-name dir))
-- 
2.41.0


^ permalink raw reply related	[relevance 5%]

* bug#65666: Lockfiles break package-vc-install-from-checkout
  2023-09-01  6:18  5% ` joseph--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-01 12:52  0%   ` Philip Kaludercic
  2023-09-01 23:43  5%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-09-01 12:52 UTC (permalink / raw)
  To: joseph; +Cc: adam.porter, Eli Zaretskii, 65666

joseph@breatheoutbreathe.in writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>> We should not try to native-compile lock files, obviously.  Some code
>> naïvely uses "*.el" to find all the Lisp files; it should filter out
>> lock files.
>
> Please see attached patch.
>
>> P.S. Please always say in what version of Emacs you see the problem
>> you report.  Bonus points for including all of the information
>> collected by report-emacs-bug about your system and Emacs
>> configurations.
>
> Thanks - I'm on 29.0.92. I'll include that information next time.
>
> From 7b38b0bfd8c9da08daf734f6d0062d31dd54b947 Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Thu, 31 Aug 2023 23:11:53 -0700
> Subject: [PATCH] Don't native compile lock files
>
> * lisp/emacs-lisp/package.el (package--delete-directory):
> Check that each file exists before compiling.
> ---
>  lisp/emacs-lisp/package.el | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index e1172d69bf0..52a538e0627 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -2485,6 +2485,7 @@ compiled."
>    (when (featurep 'native-compile)
>      (cl-loop
>       for file in (directory-files-recursively dir "\\.el\\'")
> +     when (file-exists-p file)
>       do (comp-clean-up-stale-eln (comp-el-to-eln-filename file))))
>    (if (file-symlink-p (directory-file-name dir))
>        (delete-file (directory-file-name dir))

LGTM, but I wonder if there is a better way to detect lockfiles
specifically?  If not, I can imagine that just using `file-exists-p'
would a too broad check, in the sense that it could make it difficult to
find other issues?





^ permalink raw reply	[relevance 0%]

* bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails
  2023-08-31 21:19  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-08-31 21:39 11%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-01 13:14  7%         ` Philip Kaludercic
  2023-09-01 23:28  9%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-09-01 13:14 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 65649

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Btw, watch out when reporting a bug, you shouldn't CC people directly,
>> but add a X-Debbugs-CC header
>> (https://debbugs.gnu.org/Reporting.html#xcc), as otherwise I'd be
>> creating a new bug report when responding to your message.
>
> Good to know! Thank you! Is it okay to CC people when responding to a
> bug report email (e.g. if I CC'd Eli in this email)?

Yes, as soon as one is sending a message to [bugnumber]@debbugs.gnu.org,
everything is fine.  The issue if you Cc me directly, is that if I don't
watch out, I'll send my response to bug-gnu-emacs@gnu.org, and thus
create a new bug.

>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>
>>> It would be nice to report more information about the package with failed
>>> documentation, but AFAICT with-demoted-errors does not allow its FORMAT
>>> string to be a symbol whose value is a string.
>>
>> What are the main errors we are concerned with?  I am a bit concerned
>> that `with-demoted-errors' is a too coarse approach and might be applied
>> to widely in your current patch.  It might be better to use a classical
>> condition-case and handle the right errors in the right place, or if
>> practicable try to detect if an error would occur before doing anything.
>
> I don't know what kinds of errors to expect, which is why I went with
> the coarse approach.  Under what circumstances would we want to stop
> package installation entirely when documentation can't be built?

I am not sure we want that behaviour at all actually.  Just because
there is a typo in the documentation, doesn't mean the package is
unusable.  The user should be able to install the package, be notified
about the error -- if the have the time, they can fix it and send the
maintainer a patch resolving the issue for everyone.  Likewise, if the
user updates a package, it wouldn't make sense to ignore everything or
worse still revert the update due to a small mistake in the
documentation file.

>> Also, the buffer *package-vc doc* should stay persistent and would
>> include error messages, that could also be used here.
>
> Like this?
>
> (with-demoted-errors "package-vc: Could not build documentation. See *package-vc doc* for details" ... )

Yes, that is what I had in mind.

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Philip Kaludercic <philipk@posteo.net> writes:
>>
>>> Also, the buffer *package-vc doc* should stay persistent and would
>>> include error messages, that could also be used here.
>>
>> Like this?
>>
>> (with-demoted-errors "package-vc: Could not build documentation. See *package-vc doc* for details" ... )
>
> Actually, that would not have handled the error related to relative org
> #+include statements, since that error happened above this line:
>
> (with-current-buffer (get-buffer-create " *package-vc doc*")

There is no reason why we cannot already create and use the buffer
earlier, to log org-related bugs.  One has to be careful when emptying
the buffer, but it might make sense to have a separate buffer for each
package, especially when updating multiple packages at once...





^ permalink raw reply	[relevance 7%]

* bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails
  2023-09-01 13:14  7%         ` Philip Kaludercic
@ 2023-09-01 23:28  9%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-02 12:03  5%             ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-01 23:28 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 65649

[-- Attachment #1: Type: text/plain, Size: 1151 bytes --]


Philip Kaludercic <philipk@posteo.net> writes:

> Yes, as soon as one is sending a message to [bugnumber]@debbugs.gnu.org,
> everything is fine.  The issue if you Cc me directly, is that if I don't
> watch out, I'll send my response to bug-gnu-emacs@gnu.org, and thus
> create a new bug.

Thanks, that's clear now.

> I am not sure we want that behaviour at all actually.  Just because
> there is a typo in the documentation, doesn't mean the package is
> unusable.  The user should be able to install the package, be notified
> about the error -- if the have the time, they can fix it and send the
> maintainer a patch resolving the issue for everyone.  Likewise, if the
> user updates a package, it wouldn't make sense to ignore everything or
> worse still revert the update due to a small mistake in the
> documentation file.
>
> ...
>
> There is no reason why we cannot already create and use the buffer
> earlier, to log org-related bugs.  One has to be careful when emptying
> the buffer, but it might make sense to have a separate buffer for each
> package, especially when updating multiple packages at once...

Please see attached patches.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Include-package-name-in-package-vc-documentation-log.patch --]
[-- Type: text/x-diff, Size: 1031 bytes --]

From aa356f561ab7861f463d3024f574fc71d45cb00b Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Wed, 30 Aug 2023 23:24:16 -0700
Subject: [PATCH 1/2] Include package name in package-vc documentation log
 buffer name

* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
---
 lisp/emacs-lisp/package-vc.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 747fe696204..ea8d9ecf488 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -423,7 +423,7 @@ otherwise it's assumed to be an Info file."
         (let ((default-directory docs-directory))
           (org-export-to-file 'texinfo file))
         (setq clean-up t)))
-    (with-current-buffer (get-buffer-create " *package-vc doc*")
+    (with-current-buffer (get-buffer-create (format " *package-vc doc: %s*" pkg-name))
       (erase-buffer)
       (cond
        ((/= 0 (call-process "makeinfo" nil t nil
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Log-org-export-errors-to-package-vc-doc-buffer.patch --]
[-- Type: text/x-diff, Size: 3467 bytes --]

From 010dabfbba8ebeb7f7193482ae2ffc7ec5b694e3 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Fri, 1 Sep 2023 16:22:45 -0700
Subject: [PATCH 2/2] Log org export errors to package-vc doc buffer

* lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
Wrap the org-export logic in condition-case, allowing package
installation to continue while preserving error messages.
---
 lisp/emacs-lisp/package-vc.el | 52 +++++++++++++++++++----------------
 1 file changed, 29 insertions(+), 23 deletions(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index ea8d9ecf488..a8393cb7e75 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -413,30 +413,36 @@ otherwise it's assumed to be an Info file."
          (default-directory (package-desc-dir pkg-desc))
          (docs-directory (file-name-directory (expand-file-name file)))
          (output (expand-file-name (format "%s.info" pkg-name)))
+         (log-buffer (get-buffer-create (format " *package-vc doc: %s*" pkg-name)))
          clean-up)
-    (when (string-match-p "\\.org\\'" file)
-      (require 'ox)
-      (require 'ox-texinfo)
-      (with-temp-buffer
-        (insert-file-contents file)
-        (setq file (make-temp-file "ox-texinfo-"))
-        (let ((default-directory docs-directory))
-          (org-export-to-file 'texinfo file))
-        (setq clean-up t)))
-    (with-current-buffer (get-buffer-create (format " *package-vc doc: %s*" pkg-name))
-      (erase-buffer)
-      (cond
-       ((/= 0 (call-process "makeinfo" nil t nil
-                            "-I" docs-directory
-                            "--no-split" file
-                            "-o" output))
-        (message "Failed to build manual %s, see buffer %S"
-                 file (buffer-name)))
-       ((/= 0 (call-process "install-info" nil t nil
-                            output (expand-file-name "dir")))
-        (message "Failed to install manual %s, see buffer %S"
-                 output (buffer-name)))
-       ((kill-buffer))))
+    (with-current-buffer log-buffer
+      (erase-buffer))
+    (condition-case err
+        (progn
+          (when (string-match-p "\\.org\\'" file)
+            (require 'ox)
+            (require 'ox-texinfo)
+            (with-temp-buffer
+              (insert-file-contents file)
+              (setq file (make-temp-file "ox-texinfo-"))
+              (let ((default-directory docs-directory))
+                (org-export-to-file 'texinfo file))
+              (setq clean-up t)))
+          (cond
+           ((/= 0 (call-process "makeinfo" nil log-buffer nil
+                                "-I" docs-directory
+                                "--no-split" file
+                                "-o" output))
+            (message "Failed to build manual %s, see buffer %S"
+                     file (buffer-name)))
+           ((/= 0 (call-process "install-info" nil log-buffer nil
+                                output (expand-file-name "dir")))
+            (message "Failed to install manual %s, see buffer %S"
+                     output (buffer-name)))
+           ((kill-buffer log-buffer))))
+      (error (with-current-buffer log-buffer
+               (insert (error-message-string err)))
+             (message "Failed to export org manual for %s, see buffer %S" pkg-name log-buffer)))
     (when clean-up
       (delete-file file))))
 
-- 
2.41.0


^ permalink raw reply related	[relevance 9%]

* bug#65666: Lockfiles break package-vc-install-from-checkout
  2023-09-01 12:52  0%   ` Philip Kaludercic
@ 2023-09-01 23:43  5%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-02  7:49  0%       ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-01 23:43 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: adam.porter, Eli Zaretskii, 65666


Philip Kaludercic <philipk@posteo.net> writes:

> LGTM, but I wonder if there is a better way to detect lockfiles
> specifically?  If not, I can imagine that just using `file-exists-p'
> would a too broad check, in the sense that it could make it difficult to
> find other issues?

We could use a regex like

(unless (string-match-p (rx string-start ".#") file))






^ permalink raw reply	[relevance 5%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
  2023-08-26  7:32 10%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-02  7:30  0%             ` Eli Zaretskii
      0 siblings, 2 replies; 200+ results
From: Eli Zaretskii @ 2023-09-02  7:30 UTC (permalink / raw)
  To: Joseph Turner, Stefan Monnier; +Cc: jonas, 65414

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: 65414@debbugs.gnu.org, jonas@bernoul.li
> Date: Sat, 26 Aug 2023 00:32:23 -0700
> 
> 
> > In any case, not calling save-some-buffers-functions when PRED is
> > non-nil is not something we can do, as that would be an incompatible
> > behavior change.  We could perhaps add PRED to the arguments with
> > which save-some-buffers-functions are called, as an optional argument.
> > Would that be satisfactory?
> 
> Yes, that would solve the interference between Magit and hyperdrive.el.
> 
> See patch.

Hmm... but how to make this change backward-compatible?  I mean, if
there's some function out there that is used in
save-some-buffers-functions, and it was written to accept only 2
arguments, we cannot safely call it with 3 arguments, can we?

Stefan, do we have any way of doing that without causing errors?

If not, perhaps the way forward is to bind some variable around the
call to these functions, whose value will be PRED?





^ permalink raw reply	[relevance 0%]

* bug#65666: Lockfiles break package-vc-install-from-checkout
  2023-09-01 23:43  5%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-02  7:49  0%       ` Eli Zaretskii
  2023-09-02 17:15 10%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-09-02  7:49 UTC (permalink / raw)
  To: Joseph Turner; +Cc: adam.porter, philipk, 65666

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: Eli Zaretskii <eliz@gnu.org>, 65666@debbugs.gnu.org, adam.porter@47ap.net
> Date: Fri, 01 Sep 2023 16:43:27 -0700
> 
> 
> Philip Kaludercic <philipk@posteo.net> writes:
> 
> > LGTM, but I wonder if there is a better way to detect lockfiles
> > specifically?  If not, I can imagine that just using `file-exists-p'
> > would a too broad check, in the sense that it could make it difficult to
> > find other issues?
> 
> We could use a regex like
> 
> (unless (string-match-p (rx string-start ".#") file))

Or make the REGEXP argument to directory-files-recursively more
specific, to reject lock files.

But yes, the use of file-exists-p is not TRT, IMO.





^ permalink raw reply	[relevance 0%]

* bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails
  2023-09-01 23:28  9%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-02 12:03  5%             ` Philip Kaludercic
  2023-09-02 16:49  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-09-02 12:03 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 65649

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Yes, as soon as one is sending a message to [bugnumber]@debbugs.gnu.org,
>> everything is fine.  The issue if you Cc me directly, is that if I don't
>> watch out, I'll send my response to bug-gnu-emacs@gnu.org, and thus
>> create a new bug.
>
> Thanks, that's clear now.
>
>> I am not sure we want that behaviour at all actually.  Just because
>> there is a typo in the documentation, doesn't mean the package is
>> unusable.  The user should be able to install the package, be notified
>> about the error -- if the have the time, they can fix it and send the
>> maintainer a patch resolving the issue for everyone.  Likewise, if the
>> user updates a package, it wouldn't make sense to ignore everything or
>> worse still revert the update due to a small mistake in the
>> documentation file.
>>
>> ...
>>
>> There is no reason why we cannot already create and use the buffer
>> earlier, to log org-related bugs.  One has to be careful when emptying
>> the buffer, but it might make sense to have a separate buffer for each
>> package, especially when updating multiple packages at once...
>
> Please see attached patches.
>
>>From aa356f561ab7861f463d3024f574fc71d45cb00b Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Wed, 30 Aug 2023 23:24:16 -0700
> Subject: [PATCH 1/2] Include package name in package-vc documentation log
>  buffer name
>
> * lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
> ---
>  lisp/emacs-lisp/package-vc.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index 747fe696204..ea8d9ecf488 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -423,7 +423,7 @@ otherwise it's assumed to be an Info file."
>          (let ((default-directory docs-directory))
>            (org-export-to-file 'texinfo file))
>          (setq clean-up t)))
> -    (with-current-buffer (get-buffer-create " *package-vc doc*")
> +    (with-current-buffer (get-buffer-create (format " *package-vc doc: %s*" pkg-name))
>        (erase-buffer)
>        (cond
>         ((/= 0 (call-process "makeinfo" nil t nil
> -- 
> 2.41.0

This looks good, thanks!

>
>>From 010dabfbba8ebeb7f7193482ae2ffc7ec5b694e3 Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Fri, 1 Sep 2023 16:22:45 -0700
> Subject: [PATCH 2/2] Log org export errors to package-vc doc buffer
>
> * lisp/emacs-lisp/package-vc.el (package-vc--build-documentation):
> Wrap the org-export logic in condition-case, allowing package
> installation to continue while preserving error messages.
> ---
>  lisp/emacs-lisp/package-vc.el | 52 +++++++++++++++++++----------------
>  1 file changed, 29 insertions(+), 23 deletions(-)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index ea8d9ecf488..a8393cb7e75 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -413,30 +413,36 @@ otherwise it's assumed to be an Info file."
>           (default-directory (package-desc-dir pkg-desc))
>           (docs-directory (file-name-directory (expand-file-name file)))
>           (output (expand-file-name (format "%s.info" pkg-name)))
> +         (log-buffer (get-buffer-create (format " *package-vc doc: %s*" pkg-name)))
>           clean-up)
> -    (when (string-match-p "\\.org\\'" file)
> -      (require 'ox)
> -      (require 'ox-texinfo)
> -      (with-temp-buffer
> -        (insert-file-contents file)
> -        (setq file (make-temp-file "ox-texinfo-"))
> -        (let ((default-directory docs-directory))
> -          (org-export-to-file 'texinfo file))
> -        (setq clean-up t)))
> -    (with-current-buffer (get-buffer-create (format " *package-vc doc: %s*" pkg-name))
> -      (erase-buffer)
> -      (cond
> -       ((/= 0 (call-process "makeinfo" nil t nil
> -                            "-I" docs-directory
> -                            "--no-split" file
> -                            "-o" output))
> -        (message "Failed to build manual %s, see buffer %S"
> -                 file (buffer-name)))
> -       ((/= 0 (call-process "install-info" nil t nil
> -                            output (expand-file-name "dir")))
> -        (message "Failed to install manual %s, see buffer %S"
> -                 output (buffer-name)))
> -       ((kill-buffer))))
> +    (with-current-buffer log-buffer
> +      (erase-buffer))
> +    (condition-case err
> +        (progn
> +          (when (string-match-p "\\.org\\'" file)
> +            (require 'ox)
> +            (require 'ox-texinfo)
> +            (with-temp-buffer
> +              (insert-file-contents file)
> +              (setq file (make-temp-file "ox-texinfo-"))
> +              (let ((default-directory docs-directory))
> +                (org-export-to-file 'texinfo file))
> +              (setq clean-up t)))
> +          (cond
> +           ((/= 0 (call-process "makeinfo" nil log-buffer nil
> +                                "-I" docs-directory
> +                                "--no-split" file
> +                                "-o" output))
> +            (message "Failed to build manual %s, see buffer %S"
> +                     file (buffer-name)))
> +           ((/= 0 (call-process "install-info" nil log-buffer nil
> +                                output (expand-file-name "dir")))
> +            (message "Failed to install manual %s, see buffer %S"
> +                     output (buffer-name)))
> +           ((kill-buffer log-buffer))))
> +      (error (with-current-buffer log-buffer
> +               (insert (error-message-string err)))
> +             (message "Failed to export org manual for %s, see buffer %S" pkg-name log-buffer)))

I think it would be better to wrap only the org code in the
`condition-case' body, ideally with a more specific error type (if that
doesn't exist, that is something we could mention to the Org
maintainers).

>      (when clean-up
>        (delete-file file))))





^ permalink raw reply	[relevance 5%]

* bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails
  2023-09-02 12:03  5%             ` Philip Kaludercic
@ 2023-09-02 16:49  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-03  7:00  5%                 ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-02 16:49 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 65649


Philip Kaludercic <philipk@posteo.net> writes:

> I think it would be better to wrap only the org code in the
> `condition-case' body, ideally with a more specific error type (if that
> doesn't exist, that is something we could mention to the Org
> maintainers).

The reason I wrapped both the org-export and makeinfo logic in
condition-case is so that the makeinfo logic does not run when the
org-export logic fails. Is there a better way?

We could let-bind a flag like failed-org-export-p, then set it to t in
the condition case handler, then only run makeinfo when
failed-org-export-p is nil. Seems a bit ugly.

The only define-error in org-mode that's relevant to org-export is not
general enough:

(define-error 'org-link-broken "Unable to resolve link; aborting")






^ permalink raw reply	[relevance 5%]

* bug#65666: Lockfiles break package-vc-install-from-checkout
  2023-09-02  7:49  0%       ` Eli Zaretskii
@ 2023-09-02 17:15 10%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-02 17:21  0%           ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-02 17:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: adam.porter, philipk, 65666

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:
> Or make the REGEXP argument to directory-files-recursively more
> specific, to reject lock files.
>
> But yes, the use of file-exists-p is not TRT, IMO.

See patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Don-t-native-compile-lock-files.patch --]
[-- Type: text/x-diff, Size: 1169 bytes --]

From 31ea77e547e333c8e216d759c1c26ad1fe6c4df0 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 2 Sep 2023 10:14:22 -0700
Subject: [PATCH] Don't native compile lock files

* lisp/emacs-lisp/package.el (package--delete-directory):
Exclude lock files in regex.
---
 lisp/emacs-lisp/package.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index e1172d69bf0..8bc7936a5bf 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2484,7 +2484,9 @@ Clean-up the corresponding .eln files if Emacs is native
 compiled."
   (when (featurep 'native-compile)
     (cl-loop
-     for file in (directory-files-recursively dir "\\.el\\'")
+     for file in (directory-files-recursively dir
+                                              ;; Exclude lockfiles
+                                              (rx bos (or (and "." (not "#")) (not ".")) (* nonl) ".el" eos))
      do (comp-clean-up-stale-eln (comp-el-to-eln-filename file))))
   (if (file-symlink-p (directory-file-name dir))
       (delete-file (directory-file-name dir))
-- 
2.41.0


^ permalink raw reply related	[relevance 10%]

* bug#65666: Lockfiles break package-vc-install-from-checkout
  2023-09-02 17:15 10%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-02 17:21  0%           ` Eli Zaretskii
  2023-09-03  7:03  0%             ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-09-02 17:21 UTC (permalink / raw)
  To: Joseph Turner; +Cc: adam.porter, philipk, 65666

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: philipk@posteo.net, 65666@debbugs.gnu.org, adam.porter@47ap.net
> Date: Sat, 02 Sep 2023 10:15:48 -0700
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> > Or make the REGEXP argument to directory-files-recursively more
> > specific, to reject lock files.
> >
> > But yes, the use of file-exists-p is not TRT, IMO.
> 
> See patch.

Thanks, this LGTM.





^ permalink raw reply	[relevance 0%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  2023-05-23 20:14  9%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-02 23:54  9%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-03  6:08  0%         ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-02 23:54 UTC (permalink / raw)
  To: Eli Zaretskii, Phillip Lord, Stefan Monnier, 63513, adam

[-- Attachment #1: Type: text/plain, Size: 60 bytes --]

I fixed the definition of persist-hash-equal, and rebased.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-test-persist-save-macro.patch --]
[-- Type: text/x-diff, Size: 3379 bytes --]

From 6ec3955a521266e0661bbd0b2a6d1984875ae1a1 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 12:57:02 -0700
Subject: [PATCH 1/5] Add test-persist-save macro

---
 test/persist-tests.el | 76 +++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 43 deletions(-)

diff --git a/test/persist-tests.el b/test/persist-tests.el
index b6645a9297..0a85b78767 100644
--- a/test/persist-tests.el
+++ b/test/persist-tests.el
@@ -25,51 +25,41 @@ (ert-deftest test-persist-save-only-persistant ()
    :type 'error
    :exclude-subtypes t))
 
-(ert-deftest test-persist-save ()
-  (with-local-temp-persist
-   (let ((sym (cl-gensym)))
-     ;; precondition
-   (should-not (file-exists-p (persist--file-location sym)))
-     (set sym 10)
-     (persist-symbol sym 10)
-     (persist-save sym)
-     (should t)
-     (should-not (file-exists-p (persist--file-location sym)))
-     (set sym 20)
-     (persist-save sym)
-     (should (file-exists-p (persist--file-location sym)))
-     (should
-      (string-match-p
-       "20"
-       (with-temp-buffer
-         (insert-file-contents (persist--file-location sym))
-         (buffer-string))))
-     (set sym 10)
-     (persist-save sym)
-     (should-not (file-exists-p (persist--file-location sym)))
-     (should-error
-      (persist-save 'fred)))))
+(defmacro test-persist-save (init default change printed-changed)
+  "Test persisting symbols.
+- symbol is not persisted when value is set to INIT and default
+  value is set to DEFAULT.
+- symbol is persisted when value is changed according to CHANGE.
+- persisted file contents match PRINTED-CHANGED.
+- symbol is not persisted after value is set back to DEFAULT."
+  `(with-local-temp-persist
+    (let ((sym (cl-gensym)))
+      (should-not (file-exists-p (persist--file-location sym)))
+      (set sym ,init)
+      (persist-symbol sym ,default)
+      (persist-save sym)
+      (should t)
+      (should-not (file-exists-p (persist--file-location sym)))
+      ,change
+      (persist-save sym)
+      (should (file-exists-p (persist--file-location sym)))
+      (should
+       (string-match-p
+        ,printed-changed
+        (with-temp-buffer
+          (insert-file-contents (persist--file-location sym))
+          (buffer-string))))
+      (set sym ,default)
+      (persist-save sym)
+      (should-not (file-exists-p (persist--file-location sym))))))
 
-(ert-deftest test-persist-save-non-number ()
-  "Test saving something that is not a number.
+(ert-deftest test-persist-save-number ()
+  "Test saving number."
+  (test-persist-save 1 1 (set sym 2) "2"))
 
-`test-persist-save' missed "
-  (with-local-temp-persist
-   (let ((sym (cl-gensym)))
-     (set sym "fred")
-     (persist-symbol sym "fred")
-     (persist-save sym)
-     (should t)
-     (should-not (file-exists-p (persist--file-location sym)))
-     (set sym "george")
-     (persist-save sym)
-     (should (file-exists-p (persist--file-location sym)))
-     (should
-      (string-match-p
-       "george"
-       (with-temp-buffer
-         (insert-file-contents (persist--file-location sym))
-         (buffer-string)))))))
+(ert-deftest test-persist-save-string ()
+  "Test saving string."
+  (test-persist-save "foo" "foo" (set sym "bar") "bar"))
 
 (ert-deftest test-persist-load ()
   (with-local-temp-persist
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Add-persist-hash-equal.patch --]
[-- Type: text/x-diff, Size: 1475 bytes --]

From 1f6fae3a9799dbb58b742095480917c2e3b99a7f Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 2 Sep 2023 16:52:31 -0700
Subject: [PATCH 2/5] Add persist-hash-equal

See bug#63671.
---
 persist.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/persist.el b/persist.el
index d80943d19e..fd0d750161 100644
--- a/persist.el
+++ b/persist.el
@@ -187,5 +187,22 @@ (defun persist--save-all ()
 (add-hook 'kill-emacs-hook
           'persist--save-all)
 
+(defun persist-hash-equal (hash1 hash2)
+  "Return non-nil when the contents of HASH1 and HASH2 are equal.
+Table values are compared using `equal' unless they are both hash
+tables themselves, in which case `persist-hash-equal' is used.
+Does not compare equality predicates."
+  (and (= (hash-table-count hash1)
+          (hash-table-count hash2))
+       (catch 'flag (maphash (lambda (key hash1-value)
+                               (let ((hash2-value (gethash key hash2)))
+                                 (or (if (and (hash-table-p hash1-value)
+                                              (hash-table-p hash2-value))
+                                         (persist-hash-equal hash1-value hash2-value)
+                                       (equal hash1-value hash2-value))
+                                     (throw 'flag nil))))
+                             hash1)
+              t)))
+
 (provide 'persist)
 ;;; persist.el ends here
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Make-persist-defvar-work-with-hash-tables.patch --]
[-- Type: text/x-diff, Size: 3100 bytes --]

From ae35177b30bf1fabbc56ebf315b25a6074102201 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 13:09:29 -0700
Subject: [PATCH 3/5] Make persist-defvar work with hash tables

Previously, when persist-defvar received a hash table for an initial
value, updated values were not persisted.
---
 persist.el            | 17 ++++++++++++-----
 test/persist-tests.el |  8 ++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/persist.el b/persist.el
index fd0d750161..9a0ee33a65 100644
--- a/persist.el
+++ b/persist.el
@@ -118,7 +118,9 @@ (defun persist-symbol (symbol &optional initvalue)
   (let ((initvalue (or initvalue (symbol-value symbol))))
     (add-to-list 'persist--symbols symbol)
     (put symbol 'persist t)
-    (put symbol 'persist-default initvalue)))
+    (if (hash-table-p initvalue)
+        (put symbol 'persist-default (copy-hash-table initvalue))
+      (put symbol 'persist-default initvalue))))
 
 (defun persist--persistant-p (symbol)
   "Return non-nil if SYMBOL is a persistant variable."
@@ -132,9 +134,14 @@ (defun persist-save (symbol)
   (unless (persist--persistant-p symbol)
     (error (format
             "Symbol %s is not persistant" symbol)))
-  (let ((symbol-file-loc (persist--file-location symbol)))
-    (if (equal (symbol-value symbol)
-               (persist-default symbol))
+  (let* ((symbol-file-loc (persist--file-location symbol))
+         (value (symbol-value symbol))
+         (default (persist-default symbol))
+         (value-unchanged-p (if (and (hash-table-p value)
+                                     (hash-table-p default))
+                                (persist-hash-equal value default)
+                              (equal value default))))
+    (if value-unchanged-p
         (when (file-exists-p symbol-file-loc)
           (delete-file symbol-file-loc))
       (let ((dir-loc
@@ -148,7 +155,7 @@ (defun persist-save (symbol)
                 (print-escape-control-characters t)
                 (print-escape-nonascii t)
                 (print-circle t))
-            (print (symbol-value symbol) (current-buffer)))
+            (print value (current-buffer)))
           (write-region (point-min) (point-max)
                         symbol-file-loc
                         nil 'quiet))))))
diff --git a/test/persist-tests.el b/test/persist-tests.el
index 0a85b78767..8a30a24e23 100644
--- a/test/persist-tests.el
+++ b/test/persist-tests.el
@@ -61,6 +61,14 @@ (ert-deftest test-persist-save-string ()
   "Test saving string."
   (test-persist-save "foo" "foo" (set sym "bar") "bar"))
 
+(ert-deftest test-persist-save-hash ()
+  "Test saving hash table."
+  (let* ((hash (make-hash-table))
+         (default (copy-hash-table hash)))
+    (test-persist-save hash default
+                       (puthash 'foo "bar" (symbol-value sym))
+                       "#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data (foo \"bar\"))")))
+
 (ert-deftest test-persist-load ()
   (with-local-temp-persist
    (let ((sym (cl-gensym)))
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-Add-persist-copy-tree.patch --]
[-- Type: text/x-diff, Size: 1909 bytes --]

From 1b06fc7efb7339c390170e2bc26e298153221f2e Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 13:43:02 -0700
Subject: [PATCH 4/5] Add persist-copy-tree

The behavior of copy-tree was changed in Emacs 30. This function will
ensure that persist works correctly for previous Emacs versions.
---
 persist.el | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/persist.el b/persist.el
index 9a0ee33a65..8eb0e7ba51 100644
--- a/persist.el
+++ b/persist.el
@@ -211,5 +211,33 @@ (defun persist-hash-equal (hash1 hash2)
                              hash1)
               t)))
 
+(defun persist-copy-tree (tree &optional vectors-and-records)
+  "Make a copy of TREE.
+If TREE is a cons cell, this recursively copies both its car and its cdr.
+Contrast to `copy-sequence', which copies only along the cdrs.
+With the second argument VECTORS-AND-RECORDS non-nil, this
+traverses and copies vectors and records as well as conses."
+  (declare (side-effect-free error-free))
+  (if (consp tree)
+      (let (result)
+	(while (consp tree)
+	  (let ((newcar (car tree)))
+	    (if (or (consp (car tree))
+                    (and vectors-and-records
+                         (or (vectorp (car tree)) (recordp (car tree)))))
+		(setq newcar (copy-tree (car tree) vectors-and-records)))
+	    (push newcar result))
+	  (setq tree (cdr tree)))
+	(nconc (nreverse result)
+               (if (and vectors-and-records (or (vectorp tree) (recordp tree)))
+                   (copy-tree tree vectors-and-records)
+                 tree)))
+    (if (and vectors-and-records (or (vectorp tree) (recordp tree)))
+	(let ((i (length (setq tree (copy-sequence tree)))))
+	  (while (>= (setq i (1- i)) 0)
+	    (aset tree i (copy-tree (aref tree i) vectors-and-records)))
+	  tree)
+      tree)))
+
 (provide 'persist)
 ;;; persist.el ends here
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-Make-persist-defvar-work-with-records.patch --]
[-- Type: text/x-diff, Size: 1763 bytes --]

From afd6ea405efb1cba0ad1b1601f4af8efc796c1d7 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 13:44:40 -0700
Subject: [PATCH 5/5] Make persist-defvar work with records

Previously, when persist-defvar received a record for an initial
value, updated values were not persisted.
---
 persist.el            | 2 +-
 test/persist-tests.el | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/persist.el b/persist.el
index 8eb0e7ba51..2f3885f80e 100644
--- a/persist.el
+++ b/persist.el
@@ -120,7 +120,7 @@ (defun persist-symbol (symbol &optional initvalue)
     (put symbol 'persist t)
     (if (hash-table-p initvalue)
         (put symbol 'persist-default (copy-hash-table initvalue))
-      (put symbol 'persist-default initvalue))))
+      (put symbol 'persist-default (persist-copy-tree initvalue t)))))
 
 (defun persist--persistant-p (symbol)
   "Return non-nil if SYMBOL is a persistant variable."
diff --git a/test/persist-tests.el b/test/persist-tests.el
index 8a30a24e23..18b8af2b89 100644
--- a/test/persist-tests.el
+++ b/test/persist-tests.el
@@ -69,6 +69,14 @@ (ert-deftest test-persist-save-hash ()
                        (puthash 'foo "bar" (symbol-value sym))
                        "#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data (foo \"bar\"))")))
 
+(ert-deftest test-persist-save-record ()
+  "Test saving record."
+  (let* ((rec (record 'foo 'a 'b))
+         (default (copy-sequence rec)))
+    (test-persist-save rec default
+                       (setf (aref (symbol-value sym) 2) 'quux)
+                       "#s(foo a quux)")))
+
 (ert-deftest test-persist-load ()
   (with-local-temp-persist
    (let ((sym (cl-gensym)))
-- 
2.41.0


^ permalink raw reply related	[relevance 9%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  2023-09-02 23:54  9%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-03  6:08  0%         ` Eli Zaretskii
  2023-09-04  0:29  8%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-09-03  6:08 UTC (permalink / raw)
  To: Joseph Turner; +Cc: adam, 63513, monnier, phillip.lord

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Sat, 02 Sep 2023 16:54:00 -0700
> 
> I fixed the definition of persist-hash-equal, and rebased.

Thanks, but this lacks the commit log messages (see CONTRIBUTE).

Also, I think the new features warrant a NEWS entry.





^ permalink raw reply	[relevance 0%]

* bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails
  2023-09-02 16:49  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-03  7:00  5%                 ` Philip Kaludercic
  0 siblings, 0 replies; 200+ results
From: Philip Kaludercic @ 2023-09-03  7:00 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 65649-done

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> I think it would be better to wrap only the org code in the
>> `condition-case' body, ideally with a more specific error type (if that
>> doesn't exist, that is something we could mention to the Org
>> maintainers).
>
> The reason I wrapped both the org-export and makeinfo logic in
> condition-case is so that the makeinfo logic does not run when the
> org-export logic fails. Is there a better way?
>
> We could let-bind a flag like failed-org-export-p, then set it to t in
> the condition case handler, then only run makeinfo when
> failed-org-export-p is nil. Seems a bit ugly.

Oh right, never-mind then, I guess this is the simplest solution.

> The only define-error in org-mode that's relevant to org-export is not
> general enough:
>
> (define-error 'org-link-broken "Unable to resolve link; aborting")

Then this should be fine.  I'll apply the changes the master.  Thanks.





^ permalink raw reply	[relevance 5%]

* bug#65666: Lockfiles break package-vc-install-from-checkout
  2023-09-02 17:21  0%           ` Eli Zaretskii
@ 2023-09-03  7:03  0%             ` Philip Kaludercic
  0 siblings, 0 replies; 200+ results
From: Philip Kaludercic @ 2023-09-03  7:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: adam.porter, 65666-done, Joseph Turner

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Cc: philipk@posteo.net, 65666@debbugs.gnu.org, adam.porter@47ap.net
>> Date: Sat, 02 Sep 2023 10:15:48 -0700
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> > Or make the REGEXP argument to directory-files-recursively more
>> > specific, to reject lock files.
>> >
>> > But yes, the use of file-exists-p is not TRT, IMO.
>> 
>> See patch.
>
> Thanks, this LGTM.

Agree, I have pushed the change to master.





^ permalink raw reply	[relevance 0%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
  @ 2023-09-03 17:29  0%                 ` Eli Zaretskii
  2023-09-03 17:52  5%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-09-03 17:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: jonas, 65414, joseph

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Joseph Turner <joseph@breatheoutbreathe.in>,  65414@debbugs.gnu.org,
>   jonas@bernoul.li
> Date: Sun, 03 Sep 2023 13:06:07 -0400
> 
>  Sorry, `debbugs.gnu.org` appears to be down

It is back up.





^ permalink raw reply	[relevance 0%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
  @ 2023-09-03 17:44  0%                 ` Eli Zaretskii
  0 siblings, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-09-03 17:44 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 65414, jonas, monnier, joseph

> From: Juri Linkov <juri@linkov.net>
> Cc: Joseph Turner <joseph@breatheoutbreathe.in>,  Stefan Monnier
>  <monnier@iro.umontreal.ca>,  jonas@bernoul.li,  65414@debbugs.gnu.org
> Date: Sun, 03 Sep 2023 20:22:56 +0300
> 
> > Hmm... but how to make this change backward-compatible?  I mean, if
> > there's some function out there that is used in
> > save-some-buffers-functions, and it was written to accept only 2
> > arguments, we cannot safely call it with 3 arguments, can we?
> 
> If nothing else helps, just catch 'wrong-number-of-arguments',
> then call with an obsolete signature again.

I was hoping for a cleaner, more elegant solution.  Still do.





^ permalink raw reply	[relevance 0%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
    2023-09-03 17:29  0%                 ` Eli Zaretskii
@ 2023-09-03 17:52  5%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
    2023-09-04 10:53  0%                   ` Eli Zaretskii
  1 sibling, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-03 17:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, jonas, 65414


Stefan Monnier <monnier@iro.umontreal.ca> writes:

> [ Arguably, it would be even better to arrange for `hyperdrive.el` to
>   save its buffers "in the usual way", i.e. relying on
>   `buffer-offer-save`, `save-buffer`, `buffer-save-without-query, ...  ]

I was not aware of `buffer-offer-save`. Thank you for the suggestion!
Since we already rely on `save-buffer`, setting `buffer-offer-save` to t
is much simpler than adding to `save-some-buffers-functions`. It also
resolves the interference between Magit and hyperdrive.el.

However... I wonder what the intended purpose of
`save-some-buffers-functions` is if packages like `hyperdrive.el` are
intended to use `buffer-offer-save`?

Joseph





^ permalink raw reply	[relevance 5%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
  @ 2023-09-03 19:04  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-03 19:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, jonas, 65414


Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> However... I wonder what the intended purpose of
>> `save-some-buffers-functions` is if packages like `hyperdrive.el` are
>> intended to use `buffer-offer-save`?
>
> IIUC the purpose is to save things that are kept in variables rather
> than buffers.

Good to know. Thanks!





^ permalink raw reply	[relevance 5%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  2023-09-03  6:08  0%         ` Eli Zaretskii
@ 2023-09-04  0:29  8%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-04 11:33  0%             ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-04  0:29 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Adam Porter, 63513, monnier, phillip.lord

[-- Attachment #1: Type: text/plain, Size: 366 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

> Thanks, but this lacks the commit log messages (see CONTRIBUTE).

I have added commit log messages. See attached patches.

> Also, I think the new features warrant a NEWS entry.

Should that go in the NEWS file in the main Emacs repo? I don't see a
NEWS file in either of the main or externals/persist ELPA branches.

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-test-persist-save-macro.patch --]
[-- Type: text/x-diff, Size: 3629 bytes --]

From 2ca778a44c10f11059f16ef5922cf1eff9118105 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 12:57:02 -0700
Subject: [PATCH 1/5] Add test-persist-save macro

* test/persist-tests.el (persist-test-persist-save):
Consolidate logic of test-persist-save and
test-persist-save-non-number.
(test-persist-save-number test-persist-save-string): Simple wrappers
over persist-test-persist-save
---
 test/persist-tests.el | 76 +++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 43 deletions(-)

diff --git a/test/persist-tests.el b/test/persist-tests.el
index b6645a9297..f2b04769ef 100644
--- a/test/persist-tests.el
+++ b/test/persist-tests.el
@@ -25,51 +25,41 @@ (ert-deftest test-persist-save-only-persistant ()
    :type 'error
    :exclude-subtypes t))
 
-(ert-deftest test-persist-save ()
-  (with-local-temp-persist
-   (let ((sym (cl-gensym)))
-     ;; precondition
-   (should-not (file-exists-p (persist--file-location sym)))
-     (set sym 10)
-     (persist-symbol sym 10)
-     (persist-save sym)
-     (should t)
-     (should-not (file-exists-p (persist--file-location sym)))
-     (set sym 20)
-     (persist-save sym)
-     (should (file-exists-p (persist--file-location sym)))
-     (should
-      (string-match-p
-       "20"
-       (with-temp-buffer
-         (insert-file-contents (persist--file-location sym))
-         (buffer-string))))
-     (set sym 10)
-     (persist-save sym)
-     (should-not (file-exists-p (persist--file-location sym)))
-     (should-error
-      (persist-save 'fred)))))
+(defmacro persist-test-persist-save (init default change printed-changed)
+  "Test persisting symbols.
+- symbol is not persisted when value is set to INIT and default
+  value is set to DEFAULT.
+- symbol is persisted when value is changed according to CHANGE.
+- persisted file contents match PRINTED-CHANGED.
+- symbol is not persisted after value is set back to DEFAULT."
+  `(with-local-temp-persist
+    (let ((sym (cl-gensym)))
+      (should-not (file-exists-p (persist--file-location sym)))
+      (set sym ,init)
+      (persist-symbol sym ,default)
+      (persist-save sym)
+      (should t)
+      (should-not (file-exists-p (persist--file-location sym)))
+      ,change
+      (persist-save sym)
+      (should (file-exists-p (persist--file-location sym)))
+      (should
+       (string-match-p
+        ,printed-changed
+        (with-temp-buffer
+          (insert-file-contents (persist--file-location sym))
+          (buffer-string))))
+      (set sym ,default)
+      (persist-save sym)
+      (should-not (file-exists-p (persist--file-location sym))))))
 
-(ert-deftest test-persist-save-non-number ()
-  "Test saving something that is not a number.
+(ert-deftest test-persist-save-number ()
+  "Test saving number."
+  (persist-test-persist-save 1 1 (set sym 2) "2"))
 
-`test-persist-save' missed "
-  (with-local-temp-persist
-   (let ((sym (cl-gensym)))
-     (set sym "fred")
-     (persist-symbol sym "fred")
-     (persist-save sym)
-     (should t)
-     (should-not (file-exists-p (persist--file-location sym)))
-     (set sym "george")
-     (persist-save sym)
-     (should (file-exists-p (persist--file-location sym)))
-     (should
-      (string-match-p
-       "george"
-       (with-temp-buffer
-         (insert-file-contents (persist--file-location sym))
-         (buffer-string)))))))
+(ert-deftest test-persist-save-string ()
+  "Test saving string."
+  (persist-test-persist-save "foo" "foo" (set sym "bar") "bar"))
 
 (ert-deftest test-persist-load ()
   (with-local-temp-persist
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Add-persist-equal.patch --]
[-- Type: text/x-diff, Size: 1394 bytes --]

From b379d8d1779e0190541ef7f8adf39dfe4d4c551a Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 2 Sep 2023 16:52:31 -0700
Subject: [PATCH 2/5] Add persist-equal

* persist.el (persist-hash-equal): Like equal, but compares hash
tables also.
See bug#63671 for a discussion of built-in hash table comparison.
---
 persist.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/persist.el b/persist.el
index d80943d19e..a707d038cd 100644
--- a/persist.el
+++ b/persist.el
@@ -187,5 +187,25 @@ (defun persist--save-all ()
 (add-hook 'kill-emacs-hook
           'persist--save-all)
 
+(defun persist-equal (a b)
+  "Return non-nil when the values of A and B are equal.
+A and B are compared using `equal' unless they are both hash
+tables. In that case, the following are compared:
+
+- hash table count
+- hash table predicate
+- values, using `persist-equal'"
+  (if (and (hash-table-p a) (hash-table-p b))
+      (and (= (hash-table-count a) (hash-table-count b))
+           (eq (hash-table-test a) (hash-table-test b))
+           (catch 'done
+             (maphash
+              (lambda (key a-value)
+                (unless (persist-equal a-value (gethash key b (not a-value)))
+                  (throw 'done nil)))
+              a)
+             t))
+    (equal a b)))
+
 (provide 'persist)
 ;;; persist.el ends here
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Make-persist-defvar-work-with-hash-tables.patch --]
[-- Type: text/x-diff, Size: 2645 bytes --]

From 11194569423dcdf8778a55f59dbca8f49e8b7b37 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sun, 3 Sep 2023 17:10:38 -0700
Subject: [PATCH 3/5] Make persist-defvar work with hash tables

Previously, when persist-defvar received a hash table for an initial
value, updated values were not persisted.

* persist.el (persist-symbol): Use hash table copy as default so that
the original table can be modified without modifying the default value.
(persist-save): Use persist-equal to ensure that hash tables are
correctly compared
* test/persist-tests.el (test-persist-save-hash): Test hash tables
persistence.
---
 persist.el            | 8 +++++---
 test/persist-tests.el | 8 ++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/persist.el b/persist.el
index a707d038cd..7b2ab491d7 100644
--- a/persist.el
+++ b/persist.el
@@ -118,7 +118,9 @@ (defun persist-symbol (symbol &optional initvalue)
   (let ((initvalue (or initvalue (symbol-value symbol))))
     (add-to-list 'persist--symbols symbol)
     (put symbol 'persist t)
-    (put symbol 'persist-default initvalue)))
+    (if (hash-table-p initvalue)
+        (put symbol 'persist-default (copy-hash-table initvalue))
+      (put symbol 'persist-default initvalue))))
 
 (defun persist--persistant-p (symbol)
   "Return non-nil if SYMBOL is a persistant variable."
@@ -133,8 +135,8 @@ (defun persist-save (symbol)
     (error (format
             "Symbol %s is not persistant" symbol)))
   (let ((symbol-file-loc (persist--file-location symbol)))
-    (if (equal (symbol-value symbol)
-               (persist-default symbol))
+    (if (persist-equal (symbol-value symbol)
+                       (persist-default symbol))
         (when (file-exists-p symbol-file-loc)
           (delete-file symbol-file-loc))
       (let ((dir-loc
diff --git a/test/persist-tests.el b/test/persist-tests.el
index f2b04769ef..90adf1c6d6 100644
--- a/test/persist-tests.el
+++ b/test/persist-tests.el
@@ -61,6 +61,14 @@ (ert-deftest test-persist-save-string ()
   "Test saving string."
   (persist-test-persist-save "foo" "foo" (set sym "bar") "bar"))
 
+(ert-deftest test-persist-save-hash ()
+  "Test saving hash table."
+  (let* ((hash (make-hash-table))
+         (default (copy-hash-table hash)))
+    (persist-test-persist-save hash default
+                               (puthash 'foo "bar" (symbol-value sym))
+                               "#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data (foo \"bar\"))")))
+
 (ert-deftest test-persist-load ()
   (with-local-temp-persist
    (let ((sym (cl-gensym)))
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-Add-persist-copy-tree.patch --]
[-- Type: text/x-diff, Size: 1983 bytes --]

From f360f7ae53125a847c2a8d5762ca5f08d16445b9 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 13:43:02 -0700
Subject: [PATCH 4/5] Add persist-copy-tree

The behavior of copy-tree was changed in Emacs 30. This function will
ensure that persist works correctly for previous Emacs versions.

* persist.el (persist-copy-tree): Add copy-tree, so that records can
be compared.
---
 persist.el | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/persist.el b/persist.el
index 7b2ab491d7..93444995f2 100644
--- a/persist.el
+++ b/persist.el
@@ -209,5 +209,33 @@ (defun persist-equal (a b)
              t))
     (equal a b)))
 
+(defun persist-copy-tree (tree &optional vectors-and-records)
+  "Make a copy of TREE.
+If TREE is a cons cell, this recursively copies both its car and its cdr.
+Contrast to `copy-sequence', which copies only along the cdrs.
+With the second argument VECTORS-AND-RECORDS non-nil, this
+traverses and copies vectors and records as well as conses."
+  (declare (side-effect-free error-free))
+  (if (consp tree)
+      (let (result)
+	(while (consp tree)
+	  (let ((newcar (car tree)))
+	    (if (or (consp (car tree))
+                    (and vectors-and-records
+                         (or (vectorp (car tree)) (recordp (car tree)))))
+		(setq newcar (persist-copy-tree (car tree) vectors-and-records)))
+	    (push newcar result))
+	  (setq tree (cdr tree)))
+	(nconc (nreverse result)
+               (if (and vectors-and-records (or (vectorp tree) (recordp tree)))
+                   (persist-copy-tree tree vectors-and-records)
+                 tree)))
+    (if (and vectors-and-records (or (vectorp tree) (recordp tree)))
+	(let ((i (length (setq tree (copy-sequence tree)))))
+	  (while (>= (setq i (1- i)) 0)
+	    (aset tree i (persist-copy-tree (aref tree i) vectors-and-records)))
+	  tree)
+      tree)))
+
 (provide 'persist)
 ;;; persist.el ends here
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-Make-persist-defvar-work-with-records.patch --]
[-- Type: text/x-diff, Size: 2019 bytes --]

From ea57e6205b10678b9c26f7dcf3704e2a7acb25a7 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 13:44:40 -0700
Subject: [PATCH 5/5] Make persist-defvar work with records

Previously, when persist-defvar received a record for an initial
value, updated values were not persisted.

* persist.el (persist-symbol): Set default to a copy of initvalue so
when initvalue is a record, the original can be modified without
modifying the default.
* test/persist-tests.el: Test persist-save with a record.
---
 persist.el            | 2 +-
 test/persist-tests.el | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/persist.el b/persist.el
index 93444995f2..e43171459e 100644
--- a/persist.el
+++ b/persist.el
@@ -120,7 +120,7 @@ (defun persist-symbol (symbol &optional initvalue)
     (put symbol 'persist t)
     (if (hash-table-p initvalue)
         (put symbol 'persist-default (copy-hash-table initvalue))
-      (put symbol 'persist-default initvalue))))
+      (put symbol 'persist-default (persist-copy-tree initvalue t)))))
 
 (defun persist--persistant-p (symbol)
   "Return non-nil if SYMBOL is a persistant variable."
diff --git a/test/persist-tests.el b/test/persist-tests.el
index 90adf1c6d6..62d8501493 100644
--- a/test/persist-tests.el
+++ b/test/persist-tests.el
@@ -69,6 +69,14 @@ (ert-deftest test-persist-save-hash ()
                                (puthash 'foo "bar" (symbol-value sym))
                                "#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data (foo \"bar\"))")))
 
+(ert-deftest test-persist-save-record ()
+  "Test saving record."
+  (let* ((rec (record 'foo 'a 'b))
+         (default (copy-sequence rec)))
+    (persist-test-persist-save rec default
+                               (setf (aref (symbol-value sym) 2) 'quux)
+                               "#s(foo a quux)")))
+
 (ert-deftest test-persist-load ()
   (with-local-temp-persist
    (let ((sym (cl-gensym)))
-- 
2.41.0


^ permalink raw reply related	[relevance 8%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
  2023-09-03 17:52  5%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  @ 2023-09-04 10:53  0%                   ` Eli Zaretskii
  2023-09-04 15:54  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-09-04 10:53 UTC (permalink / raw)
  To: Joseph Turner; +Cc: jonas, monnier, 65414

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: Eli Zaretskii <eliz@gnu.org>, 65414@debbugs.gnu.org, jonas@bernoul.li
> Date: Sun, 03 Sep 2023 10:52:39 -0700
> 
> 
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
> 
> > [ Arguably, it would be even better to arrange for `hyperdrive.el` to
> >   save its buffers "in the usual way", i.e. relying on
> >   `buffer-offer-save`, `save-buffer`, `buffer-save-without-query, ...  ]
> 
> I was not aware of `buffer-offer-save`. Thank you for the suggestion!
> Since we already rely on `save-buffer`, setting `buffer-offer-save` to t
> is much simpler than adding to `save-some-buffers-functions`. It also
> resolves the interference between Magit and hyperdrive.el.

Does this mean we can close this issue without any changes to the
save-some-buffers-functions machinery?





^ permalink raw reply	[relevance 0%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  2023-09-04  0:29  8%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-04 11:33  0%             ` Eli Zaretskii
  2023-09-04 15:57  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-09-04 11:33 UTC (permalink / raw)
  To: Joseph Turner; +Cc: adam.porter, 63513, monnier, phillip.lord

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: phillip.lord@russet.org.uk, monnier@iro.umontreal.ca,
>  63513@debbugs.gnu.org, Adam Porter <adam.porter@47ap.net>
> Date: Sun, 03 Sep 2023 17:29:22 -0700
> 
> > Also, I think the new features warrant a NEWS entry.
> 
> Should that go in the NEWS file in the main Emacs repo? I don't see a
> NEWS file in either of the main or externals/persist ELPA branches.

I'm terribly sorry: I haven't realized this is for ELPA, I thought it
was for emacs.git.  My bad Please ignore what I wrote in my previous
message.





^ permalink raw reply	[relevance 0%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
  2023-09-04 10:53  0%                   ` Eli Zaretskii
@ 2023-09-04 15:54  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-04 15:59  0%                       ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-04 15:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: jonas, monnier, 65414



On September 4, 2023 3:53:24 AM PDT, Eli Zaretskii <eliz@gnu.org> wrote:
>Does this mean we can close this issue without any changes to the
>save-some-buffers-functions machinery?

That's fine by me, yes.

Thank you for taking the time to walk me through to a solution!!

Joseph





^ permalink raw reply	[relevance 5%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  2023-09-04 11:33  0%             ` Eli Zaretskii
@ 2023-09-04 15:57  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-04 17:05  5%                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-04 15:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: adam.porter, 63513, monnier, phillip.lord



On September 4, 2023 4:33:55 AM PDT, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Cc: phillip.lord@russet.org.uk, monnier@iro.umontreal.ca,
>>  63513@debbugs.gnu.org, Adam Porter <adam.porter@47ap.net>
>> Date: Sun, 03 Sep 2023 17:29:22 -0700
>> 
>> > Also, I think the new features warrant a NEWS entry.
>> 
>> Should that go in the NEWS file in the main Emacs repo? I don't see a
>> NEWS file in either of the main or externals/persist ELPA branches.
>
>I'm terribly sorry: I haven't realized this is for ELPA, I thought it
>was for emacs.git.  My bad Please ignore what I wrote in my previous
>message.

No problem! It gave me a chance to do a final editing pass. What's the next step? I would be glad for Phillip's review, if possible.





^ permalink raw reply	[relevance 5%]

* bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil
  2023-09-04 15:54  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-04 15:59  0%                       ` Eli Zaretskii
  0 siblings, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-09-04 15:59 UTC (permalink / raw)
  To: Joseph Turner; +Cc: jonas, monnier, 65414-done

> Date: Mon, 04 Sep 2023 08:54:52 -0700
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> CC: monnier@iro.umontreal.ca, 65414@debbugs.gnu.org, jonas@bernoul.li
> 
> 
> 
> On September 4, 2023 3:53:24 AM PDT, Eli Zaretskii <eliz@gnu.org> wrote:
> >Does this mean we can close this issue without any changes to the
> >save-some-buffers-functions machinery?
> 
> That's fine by me, yes.

Done.

> Thank you for taking the time to walk me through to a solution!!

You are welcome.





^ permalink raw reply	[relevance 0%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  2023-09-04 15:57  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-04 17:05  5%                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-04 22:28  8%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-05 15:08  0%                   ` phillip.lord
  0 siblings, 2 replies; 200+ results
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-04 17:05 UTC (permalink / raw)
  To: Joseph Turner; +Cc: adam.porter, Eli Zaretskii, 63513, phillip.lord

Joseph Turner [2023-09-04 08:57:13] wrote:
> On September 4, 2023 4:33:55 AM PDT, Eli Zaretskii <eliz@gnu.org> wrote:
>>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>>> Cc: phillip.lord@russet.org.uk, monnier@iro.umontreal.ca,
>>>  63513@debbugs.gnu.org, Adam Porter <adam.porter@47ap.net>
>>> Date: Sun, 03 Sep 2023 17:29:22 -0700
>>> 
>>> > Also, I think the new features warrant a NEWS entry.
>>> 
>>> Should that go in the NEWS file in the main Emacs repo? I don't see a
>>> NEWS file in either of the main or externals/persist ELPA branches.
>>
>>I'm terribly sorry: I haven't realized this is for ELPA, I thought it
>>was for emacs.git.  My bad Please ignore what I wrote in my previous
>>message.
>
> No problem! It gave me a chance to do a final editing pass. What's the next
> step? I would be glad for Phillip's review, if possible.

I was about to ping Phil over on https://gitlab.com/phillord/persist/
but was reminded along the way that Phil gave me write access to
that repository.

Could you send me the result of your final editing pass?


        Stefan






^ permalink raw reply	[relevance 5%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  2023-09-04 17:05  5%                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-04 22:28  8%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
    2023-09-05 15:08  0%                   ` phillip.lord
  1 sibling, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-04 22:28 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Adam Porter, Eli Zaretskii, 63513, phillip.lord

[-- Attachment #1: Type: text/plain, Size: 285 bytes --]


Stefan Monnier <monnier@iro.umontreal.ca> writes:
> I was about to ping Phil over on https://gitlab.com/phillord/persist/
> but was reminded along the way that Phil gave me write access to
> that repository.
>
> Could you send me the result of your final editing pass?

Here you go!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-test-persist-save-macro.patch --]
[-- Type: text/x-diff, Size: 3629 bytes --]

From 2ca778a44c10f11059f16ef5922cf1eff9118105 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 12:57:02 -0700
Subject: [PATCH 1/5] Add test-persist-save macro

* test/persist-tests.el (persist-test-persist-save):
Consolidate logic of test-persist-save and
test-persist-save-non-number.
(test-persist-save-number test-persist-save-string): Simple wrappers
over persist-test-persist-save
---
 test/persist-tests.el | 76 +++++++++++++++++++------------------------
 1 file changed, 33 insertions(+), 43 deletions(-)

diff --git a/test/persist-tests.el b/test/persist-tests.el
index b6645a9297..f2b04769ef 100644
--- a/test/persist-tests.el
+++ b/test/persist-tests.el
@@ -25,51 +25,41 @@ (ert-deftest test-persist-save-only-persistant ()
    :type 'error
    :exclude-subtypes t))
 
-(ert-deftest test-persist-save ()
-  (with-local-temp-persist
-   (let ((sym (cl-gensym)))
-     ;; precondition
-   (should-not (file-exists-p (persist--file-location sym)))
-     (set sym 10)
-     (persist-symbol sym 10)
-     (persist-save sym)
-     (should t)
-     (should-not (file-exists-p (persist--file-location sym)))
-     (set sym 20)
-     (persist-save sym)
-     (should (file-exists-p (persist--file-location sym)))
-     (should
-      (string-match-p
-       "20"
-       (with-temp-buffer
-         (insert-file-contents (persist--file-location sym))
-         (buffer-string))))
-     (set sym 10)
-     (persist-save sym)
-     (should-not (file-exists-p (persist--file-location sym)))
-     (should-error
-      (persist-save 'fred)))))
+(defmacro persist-test-persist-save (init default change printed-changed)
+  "Test persisting symbols.
+- symbol is not persisted when value is set to INIT and default
+  value is set to DEFAULT.
+- symbol is persisted when value is changed according to CHANGE.
+- persisted file contents match PRINTED-CHANGED.
+- symbol is not persisted after value is set back to DEFAULT."
+  `(with-local-temp-persist
+    (let ((sym (cl-gensym)))
+      (should-not (file-exists-p (persist--file-location sym)))
+      (set sym ,init)
+      (persist-symbol sym ,default)
+      (persist-save sym)
+      (should t)
+      (should-not (file-exists-p (persist--file-location sym)))
+      ,change
+      (persist-save sym)
+      (should (file-exists-p (persist--file-location sym)))
+      (should
+       (string-match-p
+        ,printed-changed
+        (with-temp-buffer
+          (insert-file-contents (persist--file-location sym))
+          (buffer-string))))
+      (set sym ,default)
+      (persist-save sym)
+      (should-not (file-exists-p (persist--file-location sym))))))
 
-(ert-deftest test-persist-save-non-number ()
-  "Test saving something that is not a number.
+(ert-deftest test-persist-save-number ()
+  "Test saving number."
+  (persist-test-persist-save 1 1 (set sym 2) "2"))
 
-`test-persist-save' missed "
-  (with-local-temp-persist
-   (let ((sym (cl-gensym)))
-     (set sym "fred")
-     (persist-symbol sym "fred")
-     (persist-save sym)
-     (should t)
-     (should-not (file-exists-p (persist--file-location sym)))
-     (set sym "george")
-     (persist-save sym)
-     (should (file-exists-p (persist--file-location sym)))
-     (should
-      (string-match-p
-       "george"
-       (with-temp-buffer
-         (insert-file-contents (persist--file-location sym))
-         (buffer-string)))))))
+(ert-deftest test-persist-save-string ()
+  "Test saving string."
+  (persist-test-persist-save "foo" "foo" (set sym "bar") "bar"))
 
 (ert-deftest test-persist-load ()
   (with-local-temp-persist
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Add-persist-equal.patch --]
[-- Type: text/x-diff, Size: 1394 bytes --]

From b379d8d1779e0190541ef7f8adf39dfe4d4c551a Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 2 Sep 2023 16:52:31 -0700
Subject: [PATCH 2/5] Add persist-equal

* persist.el (persist-hash-equal): Like equal, but compares hash
tables also.
See bug#63671 for a discussion of built-in hash table comparison.
---
 persist.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/persist.el b/persist.el
index d80943d19e..a707d038cd 100644
--- a/persist.el
+++ b/persist.el
@@ -187,5 +187,25 @@ (defun persist--save-all ()
 (add-hook 'kill-emacs-hook
           'persist--save-all)
 
+(defun persist-equal (a b)
+  "Return non-nil when the values of A and B are equal.
+A and B are compared using `equal' unless they are both hash
+tables. In that case, the following are compared:
+
+- hash table count
+- hash table predicate
+- values, using `persist-equal'"
+  (if (and (hash-table-p a) (hash-table-p b))
+      (and (= (hash-table-count a) (hash-table-count b))
+           (eq (hash-table-test a) (hash-table-test b))
+           (catch 'done
+             (maphash
+              (lambda (key a-value)
+                (unless (persist-equal a-value (gethash key b (not a-value)))
+                  (throw 'done nil)))
+              a)
+             t))
+    (equal a b)))
+
 (provide 'persist)
 ;;; persist.el ends here
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Make-persist-defvar-work-with-hash-tables.patch --]
[-- Type: text/x-diff, Size: 2645 bytes --]

From 11194569423dcdf8778a55f59dbca8f49e8b7b37 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sun, 3 Sep 2023 17:10:38 -0700
Subject: [PATCH 3/5] Make persist-defvar work with hash tables

Previously, when persist-defvar received a hash table for an initial
value, updated values were not persisted.

* persist.el (persist-symbol): Use hash table copy as default so that
the original table can be modified without modifying the default value.
(persist-save): Use persist-equal to ensure that hash tables are
correctly compared
* test/persist-tests.el (test-persist-save-hash): Test hash tables
persistence.
---
 persist.el            | 8 +++++---
 test/persist-tests.el | 8 ++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/persist.el b/persist.el
index a707d038cd..7b2ab491d7 100644
--- a/persist.el
+++ b/persist.el
@@ -118,7 +118,9 @@ (defun persist-symbol (symbol &optional initvalue)
   (let ((initvalue (or initvalue (symbol-value symbol))))
     (add-to-list 'persist--symbols symbol)
     (put symbol 'persist t)
-    (put symbol 'persist-default initvalue)))
+    (if (hash-table-p initvalue)
+        (put symbol 'persist-default (copy-hash-table initvalue))
+      (put symbol 'persist-default initvalue))))
 
 (defun persist--persistant-p (symbol)
   "Return non-nil if SYMBOL is a persistant variable."
@@ -133,8 +135,8 @@ (defun persist-save (symbol)
     (error (format
             "Symbol %s is not persistant" symbol)))
   (let ((symbol-file-loc (persist--file-location symbol)))
-    (if (equal (symbol-value symbol)
-               (persist-default symbol))
+    (if (persist-equal (symbol-value symbol)
+                       (persist-default symbol))
         (when (file-exists-p symbol-file-loc)
           (delete-file symbol-file-loc))
       (let ((dir-loc
diff --git a/test/persist-tests.el b/test/persist-tests.el
index f2b04769ef..90adf1c6d6 100644
--- a/test/persist-tests.el
+++ b/test/persist-tests.el
@@ -61,6 +61,14 @@ (ert-deftest test-persist-save-string ()
   "Test saving string."
   (persist-test-persist-save "foo" "foo" (set sym "bar") "bar"))
 
+(ert-deftest test-persist-save-hash ()
+  "Test saving hash table."
+  (let* ((hash (make-hash-table))
+         (default (copy-hash-table hash)))
+    (persist-test-persist-save hash default
+                               (puthash 'foo "bar" (symbol-value sym))
+                               "#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data (foo \"bar\"))")))
+
 (ert-deftest test-persist-load ()
   (with-local-temp-persist
    (let ((sym (cl-gensym)))
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-Add-persist-copy-tree.patch --]
[-- Type: text/x-diff, Size: 1983 bytes --]

From f360f7ae53125a847c2a8d5762ca5f08d16445b9 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 13:43:02 -0700
Subject: [PATCH 4/5] Add persist-copy-tree

The behavior of copy-tree was changed in Emacs 30. This function will
ensure that persist works correctly for previous Emacs versions.

* persist.el (persist-copy-tree): Add copy-tree, so that records can
be compared.
---
 persist.el | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/persist.el b/persist.el
index 7b2ab491d7..93444995f2 100644
--- a/persist.el
+++ b/persist.el
@@ -209,5 +209,33 @@ (defun persist-equal (a b)
              t))
     (equal a b)))
 
+(defun persist-copy-tree (tree &optional vectors-and-records)
+  "Make a copy of TREE.
+If TREE is a cons cell, this recursively copies both its car and its cdr.
+Contrast to `copy-sequence', which copies only along the cdrs.
+With the second argument VECTORS-AND-RECORDS non-nil, this
+traverses and copies vectors and records as well as conses."
+  (declare (side-effect-free error-free))
+  (if (consp tree)
+      (let (result)
+	(while (consp tree)
+	  (let ((newcar (car tree)))
+	    (if (or (consp (car tree))
+                    (and vectors-and-records
+                         (or (vectorp (car tree)) (recordp (car tree)))))
+		(setq newcar (persist-copy-tree (car tree) vectors-and-records)))
+	    (push newcar result))
+	  (setq tree (cdr tree)))
+	(nconc (nreverse result)
+               (if (and vectors-and-records (or (vectorp tree) (recordp tree)))
+                   (persist-copy-tree tree vectors-and-records)
+                 tree)))
+    (if (and vectors-and-records (or (vectorp tree) (recordp tree)))
+	(let ((i (length (setq tree (copy-sequence tree)))))
+	  (while (>= (setq i (1- i)) 0)
+	    (aset tree i (persist-copy-tree (aref tree i) vectors-and-records)))
+	  tree)
+      tree)))
+
 (provide 'persist)
 ;;; persist.el ends here
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-Make-persist-defvar-work-with-records.patch --]
[-- Type: text/x-diff, Size: 2019 bytes --]

From ea57e6205b10678b9c26f7dcf3704e2a7acb25a7 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 23 May 2023 13:44:40 -0700
Subject: [PATCH 5/5] Make persist-defvar work with records

Previously, when persist-defvar received a record for an initial
value, updated values were not persisted.

* persist.el (persist-symbol): Set default to a copy of initvalue so
when initvalue is a record, the original can be modified without
modifying the default.
* test/persist-tests.el: Test persist-save with a record.
---
 persist.el            | 2 +-
 test/persist-tests.el | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/persist.el b/persist.el
index 93444995f2..e43171459e 100644
--- a/persist.el
+++ b/persist.el
@@ -120,7 +120,7 @@ (defun persist-symbol (symbol &optional initvalue)
     (put symbol 'persist t)
     (if (hash-table-p initvalue)
         (put symbol 'persist-default (copy-hash-table initvalue))
-      (put symbol 'persist-default initvalue))))
+      (put symbol 'persist-default (persist-copy-tree initvalue t)))))
 
 (defun persist--persistant-p (symbol)
   "Return non-nil if SYMBOL is a persistant variable."
diff --git a/test/persist-tests.el b/test/persist-tests.el
index 90adf1c6d6..62d8501493 100644
--- a/test/persist-tests.el
+++ b/test/persist-tests.el
@@ -69,6 +69,14 @@ (ert-deftest test-persist-save-hash ()
                                (puthash 'foo "bar" (symbol-value sym))
                                "#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8125 data (foo \"bar\"))")))
 
+(ert-deftest test-persist-save-record ()
+  "Test saving record."
+  (let* ((rec (record 'foo 'a 'b))
+         (default (copy-sequence rec)))
+    (persist-test-persist-save rec default
+                               (setf (aref (symbol-value sym) 2) 'quux)
+                               "#s(foo a quux)")))
+
 (ert-deftest test-persist-load ()
   (with-local-temp-persist
    (let ((sym (cl-gensym)))
-- 
2.41.0


^ permalink raw reply related	[relevance 8%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  2023-09-04 17:05  5%                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-04 22:28  8%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-05 15:08  0%                   ` phillip.lord
  1 sibling, 0 replies; 200+ results
From: phillip.lord @ 2023-09-05 15:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: adam.porter, Eli Zaretskii, 63513, Joseph Turner

On 2023-09-04 18:05, Stefan Monnier wrote:
> Joseph Turner [2023-09-04 08:57:13] wrote:
>> On September 4, 2023 4:33:55 AM PDT, Eli Zaretskii <eliz@gnu.org> 
>> wrote:
>>>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>>>> Cc: phillip.lord@russet.org.uk, monnier@iro.umontreal.ca,
>>>>  63513@debbugs.gnu.org, Adam Porter <adam.porter@47ap.net>
>>>> Date: Sun, 03 Sep 2023 17:29:22 -0700
>>>> 
>>>> > Also, I think the new features warrant a NEWS entry.
>>>> 
>>>> Should that go in the NEWS file in the main Emacs repo? I don't see 
>>>> a
>>>> NEWS file in either of the main or externals/persist ELPA branches.
>>> 
>>> I'm terribly sorry: I haven't realized this is for ELPA, I thought it
>>> was for emacs.git.  My bad Please ignore what I wrote in my previous
>>> message.
>> 
>> No problem! It gave me a chance to do a final editing pass. What's the 
>> next
>> step? I would be glad for Phillip's review, if possible.
> 
> I was about to ping Phil over on https://gitlab.com/phillord/persist/
> but was reminded along the way that Phil gave me write access to
> that repository.
> 
> Could you send me the result of your final editing pass?


Indeed! I am afraid I am fairly unresponsive these days ("real life" 
intrudes), but I am more than happy for you to update there.

Phil





^ permalink raw reply	[relevance 0%]

* bug#65764: Fix typo in backward-word-strictly
@ 2023-09-05 19:35 11% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-05 19:50  5% ` Stefan Kangas
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-05 19:35 UTC (permalink / raw)
  To: 65764

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-Fix-typo.patch --]
[-- Type: text/x-diff, Size: 924 bytes --]

From 577be585960191bd1de077aaf451f5b08895a836 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 5 Sep 2023 12:05:58 -0700
Subject: [PATCH] Fix typo

* lisp/subr.el (backward-word-strictly):
---
 lisp/subr.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 34d87e83310..6cedaffa806 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -6039,7 +6039,7 @@ by `find-word-boundary-function-table'.  It is also not interactive."
 With argument ARG, do this that many times.
 If ARG is omitted or nil, move point backward one word.
 
-This function is like `forward-word', but it is not affected
+This function is like `backward-word', but it is not affected
 by `find-word-boundary-function-table'.  It is also not interactive."
   (let ((find-word-boundary-function-table
          (if (char-table-p word-move-empty-char-table)
-- 
2.41.0






^ permalink raw reply related	[relevance 11%]

* bug#65764: Fix typo in backward-word-strictly
  2023-09-05 19:35 11% bug#65764: Fix typo in backward-word-strictly Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-05 19:50  5% ` Stefan Kangas
  0 siblings, 0 replies; 200+ results
From: Stefan Kangas @ 2023-09-05 19:50 UTC (permalink / raw)
  To: Joseph Turner, 65764-close

Version: 29.2

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> From 577be585960191bd1de077aaf451f5b08895a836 Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Tue, 5 Sep 2023 12:05:58 -0700
> Subject: [PATCH] Fix typo
>
> * lisp/subr.el (backward-word-strictly):

Thanks, installed on emacs-29.





^ permalink raw reply	[relevance 5%]

* bug#65768: Bump persist.el version
@ 2023-09-06  2:13 11% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-06 16:39  5% ` Stefan Kangas
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-06  2:13 UTC (permalink / raw)
  To: 65768

[-- Attachment #1: Type: text/plain, Size: 92 bytes --]

Please bump the version now that we've fixed that hash
table issue in persist.

See patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Bump-version.patch --]
[-- Type: text/x-diff, Size: 644 bytes --]

From 8b5ec447c3ac0c6f5efa15737f22e984bba99992 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 5 Sep 2023 19:13:06 -0700
Subject: [PATCH] Bump version

---
 persist.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/persist.el b/persist.el
index e43171459e..8a1f746ddd 100644
--- a/persist.el
+++ b/persist.el
@@ -5,7 +5,7 @@
 ;; Author: Phillip Lord <phillip.lord@russet.org.uk>
 ;; Maintainer: Phillip Lord <phillip.lord@russet.org.uk>
 ;; Package-Type: multi
-;; Version: 0.5
+;; Version: 0.6
 
 ;; The contents of this file are subject to the GPL License, Version 3.0.
 
-- 
2.41.0


^ permalink raw reply related	[relevance 11%]

* bug#65768: Bump persist.el version
  2023-09-06  2:13 11% bug#65768: Bump persist.el version Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-06 16:39  5% ` Stefan Kangas
  2023-09-16 22:28  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Stefan Kangas @ 2023-09-06 16:39 UTC (permalink / raw)
  To: Joseph Turner; +Cc: Phillip Lord, 65768

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Please bump the version now that we've fixed that hash
> table issue in persist.
>
> See patch.

Phillip, what do you think?

> From 8b5ec447c3ac0c6f5efa15737f22e984bba99992 Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Tue, 5 Sep 2023 19:13:06 -0700
> Subject: [PATCH] Bump version
>
> ---
>  persist.el | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/persist.el b/persist.el
> index e43171459e..8a1f746ddd 100644
> --- a/persist.el
> +++ b/persist.el
> @@ -5,7 +5,7 @@
>  ;; Author: Phillip Lord <phillip.lord@russet.org.uk>
>  ;; Maintainer: Phillip Lord <phillip.lord@russet.org.uk>
>  ;; Package-Type: multi
> -;; Version: 0.5
> +;; Version: 0.6
>
>  ;; The contents of this file are subject to the GPL License, Version 3.0.





^ permalink raw reply	[relevance 5%]

* bug#65797: 29.0.92; func-arity should not return (0 . many) with apply-partially
@ 2023-09-07  7:53  1% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
    0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-07  7:53 UTC (permalink / raw)
  To: 65797

Sorry, I accidentally sent an email about this to the emacs-devel list.

(func-arity (apply-partially #'eq 'foo))
  ⇒ (0 . many)

gives the impression that the following is valid:

(funcall (apply-partially #'eq 'foo) 'foo 'bar)
     error→ (wrong-number-of-arguments #<subr eq> 3)

Here's an example of where this bug comes up in real code.

This should return a list of buffers which locally bind foo:

(match-buffers (apply-partially #'local-variable-p 'foo))

but instead it signals an error:

Debugger entered--Lisp error: (wrong-number-of-arguments #<subr local-variable-p> 3)
local-variable-p(foo #<buffer *scratch*> nil)
apply(local-variable-p (foo #<buffer *scratch*> nil))
...

because buffer-match-p uses func-arity to conditionally apply ARG.

Sidenote - compat.el's buffer-match-p does this

(condition-case nil
    (funcall condition buffer)
  (wrong-number-of-arguments
   (funcall condition buffer arg)))

instead of

(if (eq 1 (cdr (func-arity condition)))
    (funcall condition buffer-or-name)
  (funcall condition buffer-or-name arg))

and is therefore immune to this bug.

Joseph

In GNU Emacs 29.0.92 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.37, cairo version 1.16.0)
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash
 SHELL=/gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash
 --prefix=/gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92
 --enable-fast-install --with-modules --with-cairo
 --with-native-compilation --disable-build-details'

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 X11 XDBE XIM XINPUT2 XPM
GTK3 ZLIB

Important settings:
  value of $EMACSLOADPATH: /home/joseph/.guix-extra-profiles/emacs/emacs/share/emacs/site-lisp:/gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp
  value of $EMACSNATIVELOADPATH: /home/joseph/.guix-extra-profiles/emacs/emacs/lib/emacs/native-site-lisp
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: mu4e:view

Minor modes in effect:
  mu4e-search-minor-mode: t
  mu4e-context-minor-mode: t
  mu4e-modeline-mode: t
  repeat-mode: t
  pixel-scroll-precision-mode: t
  engine-mode: t
  ws-butler-global-mode: t
  ws-butler-mode: t
  diff-hl-flydiff-mode: t
  magit-todos-mode: t
  global-hl-todo-mode: t
  magit-wip-initial-backup-mode: t
  magit-wip-before-change-mode: t
  magit-wip-after-apply-mode: t
  magit-wip-after-save-mode: t
  magit-wip-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  whole-line-or-region-global-mode: t
  whole-line-or-region-local-mode: t
  corfu-history-mode: t
  global-corfu-mode: t
  corfu-mode: t
  marginalia-mode: t
  vertico-reverse-mode: t
  vertico-mode: t
  display-battery-mode: t
  display-time-mode: t
  global-aggressive-indent-mode: t
  recentf-mode: t
  shell-dirtrack-mode: t
  pulsar-global-mode: t
  pulsar-mode: t
  desktop-environment-mode: t
  server-mode: t
  global-subword-mode: t
  subword-mode: t
  delete-selection-mode: t
  electric-pair-mode: t
  savehist-mode: t
  save-place-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  window-divider-mode: t
  buffer-read-only: t
  size-indication-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
  abbrev-mode: t

Load-path shadows:
/home/joseph/.emacs.d/elpa/jabber/jabber-autoloads hides /home/joseph/.emacs.d/elpa/jabber/lisp/jabber-autoloads
/gnu/store/gfp1flcfi9yxrlg35mwh4xbssd4yix20-emacs-transient-0.4.3/share/emacs/site-lisp/transient-0.4.3/transient hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/transient
/gnu/store/r5w8fq8jznd21r8pzcvb0xb1zxl6y2sc-emacs-use-package-2.4.4/share/emacs/site-lisp/use-package-2.4.4/use-package-diminish hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/use-package/use-package-diminish
/gnu/store/r5w8fq8jznd21r8pzcvb0xb1zxl6y2sc-emacs-use-package-2.4.4/share/emacs/site-lisp/use-package-2.4.4/use-package-lint hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/use-package/use-package-lint
/gnu/store/r5w8fq8jznd21r8pzcvb0xb1zxl6y2sc-emacs-use-package-2.4.4/share/emacs/site-lisp/use-package-2.4.4/use-package-jump hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/use-package/use-package-jump
/gnu/store/r5w8fq8jznd21r8pzcvb0xb1zxl6y2sc-emacs-use-package-2.4.4/share/emacs/site-lisp/use-package-2.4.4/use-package-ensure hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/use-package/use-package-ensure
/gnu/store/r5w8fq8jznd21r8pzcvb0xb1zxl6y2sc-emacs-use-package-2.4.4/share/emacs/site-lisp/use-package-2.4.4/bind-key hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/use-package/bind-key
/gnu/store/r5w8fq8jznd21r8pzcvb0xb1zxl6y2sc-emacs-use-package-2.4.4/share/emacs/site-lisp/use-package-2.4.4/use-package hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/use-package/use-package
/gnu/store/r5w8fq8jznd21r8pzcvb0xb1zxl6y2sc-emacs-use-package-2.4.4/share/emacs/site-lisp/use-package-2.4.4/use-package-delight hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/use-package/use-package-delight
/gnu/store/r5w8fq8jznd21r8pzcvb0xb1zxl6y2sc-emacs-use-package-2.4.4/share/emacs/site-lisp/use-package-2.4.4/use-package-core hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/use-package/use-package-core
/gnu/store/r5w8fq8jznd21r8pzcvb0xb1zxl6y2sc-emacs-use-package-2.4.4/share/emacs/site-lisp/use-package-2.4.4/use-package-bind-key hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/use-package/use-package-bind-key
/gnu/store/r5w8fq8jznd21r8pzcvb0xb1zxl6y2sc-emacs-use-package-2.4.4/share/emacs/site-lisp/use-package-2.4.4/use-package-ensure-system-package hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/use-package/use-package-ensure-system-package
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/oc-csl hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/oc-csl
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-haskell hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-haskell
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-pcomplete hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-pcomplete
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-fortran hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-fortran
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-eval hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-eval
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ox-ascii hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ox-ascii
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-faces hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-faces
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol-irc hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol-irc
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-latex hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-latex
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/oc-biblatex hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/oc-biblatex
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-keys hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-keys
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-entities hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-entities
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-octave hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-octave
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-forth hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-forth
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-list hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-list
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-plantuml hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-plantuml
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ox-md hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ox-md
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-feed hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-feed
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol-eshell hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol-eshell
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol-eww hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol-eww
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-java hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-java
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol-doi hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol-doi
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-src hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-src
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-goto hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-goto
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-habit hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-habit
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-lisp hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-lisp
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-js hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-js
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-tangle hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-tangle
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-clojure hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-clojure
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-julia hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-julia
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol-info hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol-info
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-sqlite hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-sqlite
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-sed hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-sed
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol-gnus hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol-gnus
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-exp hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-exp
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-gnuplot hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-gnuplot
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-table hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-table
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-num hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-num
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-lilypond hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-lilypond
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol-w3m hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol-w3m
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-sql hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-sql
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-attach hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-attach
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-capture hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-capture
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-emacs-lisp hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-emacs-lisp
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-cycle hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-cycle
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-sass hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-sass
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-fold-core hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-fold-core
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-macs hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-macs
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-archive hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-archive
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-footnote hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-footnote
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-tempo hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-tempo
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ox-odt hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ox-odt
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-screen hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-screen
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-timer hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-timer
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-comint hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-comint
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-shell hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-shell
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-dot hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-dot
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-macro hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-macro
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol-mhe hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol-mhe
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/oc-bibtex hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/oc-bibtex
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-ruby hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-ruby
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-groovy hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-groovy
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/oc-basic hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/oc-basic
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-plot hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-plot
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-lua hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-lua
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-awk hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-awk
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-calc hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-calc
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-agenda hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-agenda
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-mobile hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-mobile
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol-man hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol-man
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/oc hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/oc
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-R hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-R
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ox-beamer hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ox-beamer
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ox-icalendar hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ox-icalendar
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-processing hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-processing
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-indent hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-indent
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-inlinetask hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-inlinetask
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/oc-natbib hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/oc-natbib
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-fold hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-fold
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-attach-git hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-attach-git
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ox hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ox
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol-bibtex hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol-bibtex
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-refile hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-refile
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-protocol hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-protocol
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-python hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-python
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ox-latex hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ox-latex
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-colview hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-colview
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-duration hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-duration
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-lob hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-lob
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-ocaml hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-ocaml
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-version hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-version
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-scheme hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-scheme
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-matlab hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-matlab
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-makefile hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-makefile
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-ref hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-ref
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ox-org hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ox-org
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-loaddefs hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-loaddefs
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ox-texinfo hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ox-texinfo
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol-rmail hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol-rmail
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-perl hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-perl
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-mouse hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-mouse
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-maxima hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-maxima
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-ditaa hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-ditaa
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol-bbdb hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol-bbdb
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ox-koma-letter hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ox-koma-letter
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-lint hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-lint
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-crypt hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-crypt
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-C hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-C
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ox-html hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ox-html
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-core hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-core
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-id hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-id
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-eshell hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-eshell
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-compat hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-compat
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ol-docview hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ol-docview
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-datetree hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-datetree
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-element hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-element
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-ctags hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-ctags
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-table hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-table
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ox-man hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ox-man
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-org hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-org
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-persist hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-persist
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ob-css hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ob-css
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/org-clock hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/org-clock
/gnu/store/l4x0hyy62q491djdwx995gnss4pklp93-emacs-org-9.6.8/share/emacs/site-lisp/org-9.6.8/ox-publish hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/org/ox-publish
/gnu/store/wpbwpy52q2n6khqjplndx33gvln1clii-emacs-soap-client-3.2.3/share/emacs/site-lisp/soap-client-3.2.3/soap-inspect hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/net/soap-inspect
/gnu/store/wpbwpy52q2n6khqjplndx33gvln1clii-emacs-soap-client-3.2.3/share/emacs/site-lisp/soap-client-3.2.3/soap-client hides /gnu/store/rsyqw1rk4qswgmi1yc7jryb4fmq56y9h-emacs-next-tree-sitter-29.0.92/share/emacs/29.0.92/lisp/net/soap-client

Features:
(shadow emacsbug compat-macs rect dabbrev help-at-pt tramp-cmds crux
tramp tramp-loaddefs trampver tramp-integration tramp-compat
tempel-collection tempel hyperdrive-history hyperdrive-mirror completion
xref edebug hyperdrive-dir magit-patch magit-subtree magit-gitignore
magit-ediff ediff ediff-merg ediff-mult ediff-wind ediff-diff ediff-help
ediff-init ediff-util embark-org embark-consult embark elisp-demos
shortdoc texinfo texinfo-loaddefs cl-print package-x help-fns hyperdrive
hyperdrive-org hyperdrive-ewoc hyperdrive-lib hyperdrive-vars plz
persist ert debug backtrace org-transclusion org-transclusion-font-lock
org-transclusion-src-lines text-clone ox-texinfo ox-odt rng-loc rng-uri
rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns
nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html table ox-ascii
ox-publish ox loaddefs-gen radix-tree network-stream url-cache url-http
url-auth url-gw nsm misc cus-edit cus-start package-vc lisp-mnt
org-archive cal-move ace-window avy dired-aux gnus-dired ledger-mode
ledger-check ledger-texi ledger-test ledger-sort ledger-report
ledger-reconcile ledger-occur ledger-fonts ledger-fontify ledger-state
ledger-complete ledger-schedule ledger-init ledger-xact ledger-post
ledger-exec ledger-navigate eshell esh-cmd esh-ext esh-opt esh-proc
esh-io esh-arg esh-module esh-groups esh-util files-x ledger-context
ledger-commodities ledger-regex vc-hg vc-bzr vc-src vc-sccs vc-svn
vc-cvs vc-rcs bug-reference magit-extras org-clock undo-fu orderless
consult misearch multi-isearch qp cursor-sensor sort gnus-cite shr-color
mm-archive mail-extr textsec uni-scripts idna-mapping ucs-normalize
uni-confusable textsec-check mu4e mu4e-org mu4e-notification
notifications mu4e-main mu4e-view mu4e-headers mu4e-compose mu4e-draft
mu4e-actions smtpmail mu4e-search mu4e-lists mu4e-bookmarks mu4e-mark
mu4e-message flow-fill mule-util hl-line mu4e-contacts mu4e-update
mu4e-folders mu4e-context mu4e-query-items mu4e-server mu4e-modeline
mu4e-vars mu4e-helpers mu4e-config mu4e-window magit-bookmark bookmark
pp ido mu4e-obsolete elide-head diary-lib diary-loaddefs cal-iso vc-git
org-indent org-appear outli oc-basic ol-eww eww url-queue mm-url
ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect ol-docview doc-view
jka-compr image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m ol-doi
org-link-doi face-remap topsy makem project repeat smartparens
dired-subtree dired-hacks-utils jabber jabber-time jabber-autoaway
jabber-vcard-avatars jabber-chatstates jabber-events jabber-vcard
jabber-avatar jabber-activity jabber-watch jabber-modeline
jabber-ahc-presence jabber-ahc jabber-version jabber-ourversion
jabber-muc-nick-completion hippie-exp jabber-muc jabber-bookmarks
jabber-muc-nick-coloring jabber-browse jabber-search jabber-register
jabber-widget jabber-chat jabber-history jabber-chatbuffer jabber-roster
jabber-carbons jabber-presence jabber-private jabber-logon jabber-conn
srv dns starttls jabber-core jabber-keepalive jabber-ping jabber-disco
jabber-iq jabber-console sgml-mode facemenu jabber-truncate jabber-alert
jabber-keymap jabber-sasl sasl sasl-anonymous sasl-login sasl-plain
jabber-menu jabber-util fsm jabber-xml goto-addr pixel-scroll cua-base
engine-mode ws-butler diff-hl-flydiff diff-hl log-view vc-dir ewoc vc
vc-dispatcher magit-todos pcre2el rxt advice re-builder hl-todo f s
async grep compile magit-submodule magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log which-func imenu
magit-diff smerge-mode diff diff-mode git-commit log-edit pcvs-util
add-log magit-core magit-autorevert autorevert filenotify magit-margin
magit-transient magit-process with-editor magit-mode transient edmacro
magit-git magit-base magit-section crm dash auth-source-pass
whole-line-or-region corfu-history corfu marginalia vertico-reverse
vertico battery time aggressive-indent easy-mmode recentf tree-widget
no-littering compat compat-29 org-contacts org-capture gnus-art mm-uu
mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill
kinsoku url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus
gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time iso8601
gnus-spec gnus-int gnus-range message sendmail yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus nnheader
mail-utils range mm-util mail-prsvr wid-edit gnus-util
text-property-search org-agenda org-element org-persist xdg org-id
avl-tree generator org-refile org ob-dot ob-shell shell ob-js ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint
org-pcomplete pcomplete comint ansi-osc ansi-color ring org-list
org-footnote org-faces org-entities time-date noutline outline
ob-emacs-lisp ob-core ob-eval org-cycle org-table org-keys oc
org-loaddefs cal-menu calendar cal-loaddefs ol org-fold org-fold-core
org-compat org-version org-macs format-spec pulsar pulse color
desktop-environment dbus xml comp comp-cstr warnings icons cl-extra
help-mode exwm exwm-input xcb-keysyms xcb-xkb exwm-manage exwm-floating
xcb-cursor xcb-render exwm-layout exwm-workspace exwm-core xcb-ewmh
xcb-icccm xcb xcb-xproto xcb-types xcb-debug server
elfeed-tube-mpv-autoloads elfeed-tube-autoloads org-make-toc-autoloads
org-modern-autoloads org-ql-autoloads org-super-agenda-autoloads
ht-autoloads ts-autoloads cus-load setup kmacro org-bookmarks ffap
thingatpt cap-words superword subword modus-vivendi-theme modus-themes
pcase delsel elec-pair find-func savehist saveplace move-bank-csvs
wgrep-autoloads ws-butler-autoloads simple-httpd-autoloads
orderless-autoloads marginalia-autoloads diff-hl-autoloads
git-link-autoloads pcre2el-autoloads hl-todo-autoloads
magit-todos-autoloads interactive-align-autoloads
ace-window-breatheoutbreathein-autoloads ztree-autoloads
posframe-autoloads vertico-autoloads expand-region-autoloads
avy-autoloads embark-autoloads tempel-collection-autoloads
tempel-autoloads corfu-autoloads eat-autoloads sqlite3-api-autoloads
pg-autoloads finalize-autoloads emacsql-autoloads
emacsql-sqlite3-autoloads org-roam-autoloads consult-org-roam-autoloads
consult-dir-autoloads consult-autoloads eimp-autoloads
dired-hacks-autoloads org-appear-autoloads csv-mode-autoloads
ledger-mode-autoloads aggressive-indent-autoloads vundo-autoloads
undo-fu-autoloads crux-autoloads inspector-autoloads
soap-client-autoloads debbugs-autoloads markdown-mode-autoloads
smartparens-autoloads outli-breatheoutbreathein-autoloads
macrostep-autoloads nameless-autoloads shut-up-autoloads
spinner-autoloads loop-autoloads suggest-autoloads treepy-autoloads
elisp-demos-autoloads detached-autoloads tmr-autoloads f-autoloads
password-store-autoloads pass-autoloads disk-usage-autoloads
mpv-autoloads simple-mpc-breatheoutbreathein-autoloads kv-autoloads
esxml-autoloads nov-el-autoloads tablist-autoloads pdf-tools-autoloads
org-noter-autoloads s-autoloads elfeed-org-autoloads elfeed-autoloads
transmission-autoloads deferred-autoloads request-autoloads
webpaste-autoloads org-contacts-autoloads mu4e-autoloads
org-mime-autoloads org-present-autoloads org-autoloads
org-download-autoloads async-autoloads with-editor-autoloads
transient-autoloads magit-autoloads orgit-autoloads
org-cliplink-autoloads magit-popup-autoloads geiser-guile-autoloads
geiser-autoloads edit-indirect-autoloads dash-autoloads bui-autoloads
guix-autoloads rx pulsar-autoloads showtip-autoloads pos-tip-autoloads
popup-autoloads sdcv-autoloads nord-theme-autoloads compat-autoloads
no-littering-autoloads disable-mouse-autoloads engine-mode-autoloads
vterm-autoloads exwm-edit-autoloads desktop-environment-autoloads
xelb-autoloads exwm-autoloads setup-autoloads diminish-autoloads
use-package-autoloads guix-emacs aio-autoloads chordpro-mode-autoloads
emms-autoloads fsm-autoloads gemini-mode-autoloads hyperdrive-autoloads
jabber-autoloads org-timeblock-autoloads org-transclusion-autoloads
ov-autoloads peg-autoloads persist-autoloads pipewire-autoloads info
plz-autoloads srv-autoloads svg-tag-mode-autoloads svg-lib-autoloads
topsy-autoloads finder-inf ushin-shapes-autoloads
whole-line-or-region-autoloads xr-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv 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 nadvice seq simple cl-generic indonesian philippine
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 abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 1840338 193031)
 (symbols 48 65655 5)
 (strings 32 345161 25227)
 (string-bytes 1 14452803)
 (vectors 16 178178)
 (vector-slots 8 3960622 378098)
 (floats 8 987 1313)
 (intervals 56 74447 7074)
 (buffers 984 75))





^ permalink raw reply	[relevance 1%]

* bug#65797: 29.0.92; func-arity should not return (0 . many) with apply-partially
  @ 2023-09-08  4:40  7%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-08  6:46  0%     ` Eli Zaretskii
    1 sibling, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-08  4:40 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 65797

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]


Stefan Monnier <monnier@iro.umontreal.ca> writes:

> - Replace `&optional arg` with `&rest args` and pass those args via
>   `apply`, so the number of args passed doesn't depend on the function
>   but on the caller.

I like this idea. See patch.

> - Always pass both args to the function (i.e. as documented in the
>   docstring).

This isn't backwards compatible, is it?

Joseph



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Don-t-use-func-arity-in-buffer-match-p.patch --]
[-- Type: text/x-diff, Size: 6225 bytes --]

From 5abc2ff47b0c61baecaddd615d7f2783fe8f9c0e Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Thu, 7 Sep 2023 21:27:01 -0700
Subject: [PATCH] Don't use func-arity in buffer-match-p

* lisp/subr.el (buffer-match-p): Use &rest args instead of &optional
arg so that the number of args passed doesn't depend on the function
but on the caller. (Bug#65797)
(match-buffers): Use &rest args instead of &optional arg to match
function signature of buffer-match-p.
* doc/lispref/buffers.texi (Buffer List): Update documentation to say
ARGS instead of ARG.
---
 doc/lispref/buffers.texi | 23 ++++++++++-------------
 lisp/subr.el             | 17 ++++++++---------
 2 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 86c47ae7310..fa29afd2697 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -957,11 +957,11 @@ with a @code{nil} @var{norecord} argument since this may lead to
 infinite recursion.
 @end defvar
 
-@defun buffer-match-p condition buffer-or-name &optional arg
+@defun buffer-match-p condition buffer-or-name &rest args
 This function checks if a buffer designated by @code{buffer-or-name}
-satisfies the specified @code{condition}.  Optional third argument
-@var{arg} is passed to the predicate function in @var{condition}.  A
-valid @var{condition} can be one of the following:
+satisfies the specified @code{condition}.  Remaining arguments
+@var{args} are passed using @code{apply} to the predicate function in
+@var{condition}.  A valid @var{condition} can be one of the following:
 @itemize @bullet{}
 @item
 A string, interpreted as a regular expression.  The buffer
@@ -969,23 +969,20 @@ satisfies the condition if the regular expression matches the buffer
 name.
 @item
 A predicate function, which should return non-@code{nil} if the buffer
-matches.  If the function expects one argument, it is called with
-@var{buffer-or-name} as the argument; if it expects 2 arguments, the
-first argument is @var{buffer-or-name} and the second is @var{arg}
-(or @code{nil} if @var{arg} is omitted).
+matches.
 @item
 A cons-cell @code{(@var{oper} . @var{expr})} where @var{oper} is one
 of
 @table @code
 @item (not @var{cond})
 Satisfied if @var{cond} doesn't satisfy @code{buffer-match-p} with
-the same buffer and @code{arg}.
+the same buffer and @code{args}.
 @item (or @var{conds}@dots{})
 Satisfied if @emph{any} condition in @var{conds} satisfies
-@code{buffer-match-p}, with the same buffer and @code{arg}.
+@code{buffer-match-p}, with the same buffer and @code{args}.
 @item (and @var{conds}@dots{})
 Satisfied if @emph{all} the conditions in @var{conds} satisfy
-@code{buffer-match-p}, with the same buffer and @code{arg}.
+@code{buffer-match-p}, with the same buffer and @code{args}.
 @item derived-mode
 Satisfied if the buffer's major mode derives from @var{expr}.
 @item major-mode
@@ -998,14 +995,14 @@ string) or @code{(and)} (empty conjunction).
 @end itemize
 @end defun
 
-@defun match-buffers condition &optional buffer-list arg
+@defun match-buffers condition &optional buffer-list &rest args
 This function returns a list of all buffers that satisfy the
 @code{condition}.  If no buffers match, the function returns
 @code{nil}.  The argument @var{condition} is as defined in
 @code{buffer-match-p} above.  By default, all the buffers are
 considered, but this can be restricted via the optional argument
 @code{buffer-list}, which should be a list of buffers to consider.
-Optional third argument @var{arg} will be passed to @var{condition} in
+Remaining arguments @var{args} will be passed to @var{condition} in
 the same way as @code{buffer-match-p} does.
 @end defun
 
diff --git a/lisp/subr.el b/lisp/subr.el
index ce23a699624..87f08c669d4 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -7079,14 +7079,15 @@ lines."
             (setq start (length string)))))
       (nreverse lines))))
 
-(defun buffer-match-p (condition buffer-or-name &optional arg)
+(defun buffer-match-p (condition buffer-or-name &rest args)
   "Return non-nil if BUFFER-OR-NAME matches CONDITION.
 CONDITION is either:
 - the symbol t, to always match,
 - the symbol nil, which never matches,
 - a regular expression, to match a buffer name,
-- a predicate function that takes BUFFER-OR-NAME and ARG as
-  arguments, and returns non-nil if the buffer matches,
+- a predicate function that takes BUFFER-OR-NAME as its first
+  argument and remaining arguments ARGS, and returns non-nil if
+  the buffer matches,
 - a cons-cell, where the car describes how to interpret the cdr.
   The car can be one of the following:
   * `derived-mode': the buffer matches if the buffer's major mode
@@ -7110,9 +7111,7 @@ CONDITION is either:
                       ((pred stringp)
                        (string-match-p condition (buffer-name buffer)))
                       ((pred functionp)
-                       (if (eq 1 (cdr (func-arity condition)))
-                           (funcall condition buffer-or-name)
-                         (funcall condition buffer-or-name arg)))
+                       (apply condition buffer-or-name args))
                       (`(major-mode . ,mode)
                        (eq
                         (buffer-local-value 'major-mode buffer)
@@ -7134,17 +7133,17 @@ CONDITION is either:
                 (throw 'match t)))))))
     (funcall match (list condition))))
 
-(defun match-buffers (condition &optional buffers arg)
+(defun match-buffers (condition &optional buffers &rest args)
   "Return a list of buffers that match CONDITION, or nil if none match.
 See `buffer-match-p' for various supported CONDITIONs.
 By default all buffers are checked, but the optional
 argument BUFFERS can restrict that: its value should be
 an explicit list of buffers to check.
-Optional argument ARG is passed to `buffer-match-p', for
+Remaining arguments ARGS are passed to `buffer-match-p', for
 predicate conditions in CONDITION."
   (let (bufs)
     (dolist (buf (or buffers (buffer-list)))
-      (when (buffer-match-p condition (get-buffer buf) arg)
+      (when (buffer-match-p condition (get-buffer buf) args)
         (push buf bufs)))
     bufs))
 
-- 
2.41.0


^ permalink raw reply related	[relevance 7%]

* bug#65797: 29.0.92; func-arity should not return (0 . many) with apply-partially
  2023-09-08  4:40  7%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-08  6:46  0%     ` Eli Zaretskii
    0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-09-08  6:46 UTC (permalink / raw)
  To: Joseph Turner; +Cc: monnier, 65797

> Cc: 65797@debbugs.gnu.org
> Date: Thu, 07 Sep 2023 21:40:28 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
> 
> > - Replace `&optional arg` with `&rest args` and pass those args via
> >   `apply`, so the number of args passed doesn't depend on the function
> >   but on the caller.
> 
> I like this idea. See patch.
> 
> > - Always pass both args to the function (i.e. as documented in the
> >   docstring).
> 
> This isn't backwards compatible, is it?

Neither is what you propose, AFAIU.  We are in effect changing a
public API in incompatible ways.





^ permalink raw reply	[relevance 0%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  @ 2023-09-08 11:58  0%                         ` Eli Zaretskii
    1 sibling, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-09-08 11:58 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: adam, phillip.lord, 63513-done, monnier, joseph

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: Joseph Turner <joseph@breatheoutbreathe.in>, Adam Porter
>  <adam@alphapapa.net>, Eli Zaretskii <eliz@gnu.org>,
>  phillip.lord@russet.org.uk, 63513-done@debbugs.gnu.org
> Date: Fri, 08 Sep 2023 11:30:52 +0000
> 
> May it be possible to promote `persist-hash-equal' and
> `persist-copy-tree' to common subr.el functions?

Why do we need them in subr.el, i.e. preloaded?  Why cannot these
functions be autoloaded instead?





^ permalink raw reply	[relevance 0%]

* bug#65797: 29.0.92; func-arity should not return (0 . many) with apply-partially
  @ 2023-09-08 16:37  5%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
    2023-09-08 18:20  0%         ` Eli Zaretskii
  1 sibling, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-08 16:37 UTC (permalink / raw)
  To: Stefan Monnier, Eli Zaretskii; +Cc: 65797



On September 8, 2023 8:52:25 AM PDT, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>> This isn't backwards compatible, is it?
>> Neither is what you propose, AFAIU.  We are in effect changing a
>> public API in incompatible ways.
>
>Yup, AFAICT there's no way to implement the Texinfo-documented
>behavior reliably.
>
>So some backward-incompatibility is inevitable, unless we decide to
>stick to the current code to be "bug compatible" 

IIUC, the patch breaks code that passes a CONDITION predicate that accepts only one argument and also passes an ARG argument.

Is there another case which would break?





^ permalink raw reply	[relevance 5%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  @ 2023-09-08 17:10  5%                             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-09 10:01  5%                               ` Ihor Radchenko
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-08 17:10 UTC (permalink / raw)
  To: Ihor Radchenko
  Cc: Adam Porter, Eli Zaretskii, 63513-done, Stefan Monnier,
	phillip.lord


Ihor Radchenko <yantar92@posteo.net> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>>>> Here you go!
>>>> Thanks, pushed!
>>> May it be possible to promote `persist-hash-equal' and
>>> `persist-copy-tree' to common subr.el functions?
>>> The topic of comparing hash tables has been previously discussed in
>>> https://yhetil.org/emacs-devel/871qvz4kdw.fsf@localhost/
>>
>> Hmm... AFAICT `persist-copy-tree` is a copy of our current `copy-tree`,
>> so there's nothing to do there :-)
>
> Err...
> Then, wouldn't it be better to contribute this function to compat.el and
> use it from there?

The new behavior of copy-tree has already been added to compat.el:

https://github.com/emacs-compat/compat/pull/25

However, that change currently only exists in compat's emacs-30 branch.

I did not know if it was acceptable for persist.el to require compat
when I wrote these patches. If we agree that it is acceptable, then I'm
happy to submit a patch to replace (persist-copy-tree ...) with
(compat-call copy-tree ...), but we'll have to wait to apply the patch
until after the compat.el emacs-30 branch is merged into master.






^ permalink raw reply	[relevance 5%]

* bug#65797: 29.0.92; func-arity should not return (0 . many) with apply-partially
  @ 2023-09-08 18:16  5%             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-08 18:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, 65797


Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> IIUC, the patch breaks code that passes a CONDITION predicate that accepts
>> only one argument and also passes an ARG argument.
>>
>> Is there another case which would break?
>
> Yes, it also breaks the reverse: when you don't pass ARG but the
> function needs 2 arguments.
>
>
>         Stefan

You are right.





^ permalink raw reply	[relevance 5%]

* bug#65797: 29.0.92; func-arity should not return (0 . many) with apply-partially
    2023-09-08 16:37  5%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-08 18:20  0%         ` Eli Zaretskii
  2023-09-11 16:57  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-09-08 18:20 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 65797, joseph

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Joseph Turner <joseph@breatheoutbreathe.in>,  65797@debbugs.gnu.org
> Date: Fri, 08 Sep 2023 11:52:25 -0400
> 
> >> This isn't backwards compatible, is it?
> > Neither is what you propose, AFAIU.  We are in effect changing a
> > public API in incompatible ways.
> 
> Yup, AFAICT there's no way to implement the Texinfo-documented
> behavior reliably.
> 
> So some backward-incompatibility is inevitable, unless we decide to
> stick to the current code to be "bug compatible" :-(

I think one of the alternatives you proposed was backward-compatible
(albeit not very elegant).  So my vote is for that alternative.





^ permalink raw reply	[relevance 0%]

* bug#59609: 29.0.50; [PATCH] Better advertise (Non-)GNU ELPA in emacs manual
  @ 2023-09-08 20:10  5%           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-08 20:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 59609, stefankangas

>> FWIW, GNU ELPA packages don't necessarily "adhere to the Emacs coding
>> conventions" either and neither are they all "supervised by the Emacs
>> maintainers" or "have to coordinate their development decisions with the
>> Emacs team".  Some do, but not all of them by a long shot.
>
> Only because we decide not to do that, or are lazy, or whatever.
> Basically, it's our decision for GNU ELPA, and not so for NonGNU ELPA.

We have just as much control in one as in the other, in practice.
Maybe we tend to invest more efforts in the GNU part, but I'd argue that
it's not "because it's in GNU" but because there is a positive
correlation between people agreeing to assign their copyright and people
sharing our goals.

>> In practice the real deciding factor *is* the copyright assignment
>> (which often ends up selecting for a kind of "philosophical agreement"
>> about the primacy of ethical goals over technical ones).
> I think this is just the tip of a very large iceberg, and the FAQ
> should say that explicitly.

When I said:

    In practice the real deciding factor *is* the copyright assignment

I really meant that this is usually the only factor that makes me decide
whether to add a package to GNU or to NonGNU.
I can't speak for Philip, but I have the impression he does the same.

> Saying that just the CA is the difference is both very inaccurate and
> misrepresents the actual situation: NonGNU ELPA is a collection of
> packages that someone else decided could be useful, but we basically
> have nothing to do with them except hosting them.

"someone else"?  Packages are added there by "us":

    % git log -- elpa-packages| grep Author: | sort | uniq -c | sort -n
          1 Author: Alfred M. Szmidt <ams@gnu.org>
          1 Author: Bastien <bzg@gnu.org>
          1 Author: Bozhidar Batsov <bozhidar@batsov.com>
          1 Author: Bozhidar Batsov <bozhidar@batsov.dev>
          1 Author: Daniel Mendler <mail@daniel-mendler.de>
          1 Author: Danny Freeman <danny@dfreeman.email>
          1 Author: Distopico <distopico@riseup.net>
          1 Author: Dmitry Gutov <dgutov@yandex.ru>
          1 Author: Joseph Turner <joseph@ushin.org>
          1 Author: Sean Whitton <spwhitton@spwhitton.name>
          1 Author: Tassilo Horn <tsdh@gnu.org>
          1 Author: yilkalargaw <yilkalargawworkneh@gmail.com>
          3 Author: Daniel Semyonov <daniel@dsemy.com>
          3 Author: Eshel Yaron <me@eshelyaron.com>
          7 Author: Jonas Bernoulli <jonas@bernoul.li>
         15 Author: Akib Azmain Turja <akib@disroot.org>
         18 Author: Stefan Kangas <stefankangas@gmail.com>
         49 Author: Stefan Kangas <stefan@marxist.se>
         49 Author: Stefan Monnier <monnier@iro.umontreal.ca>
         87 Author: Philip Kaludercic <philipk@posteo.net>
    %

The result is not really different for `elpa.git`.  Several NonGNU
packages are (co)maintained by "us" (i.e. people who are regular
contributors to Emacs) and on the flip side, there are many GNU ELPA
packages for which "we basically have nothing to do with them except
hosting them".

I don't deny that there are other statistically qualitative differences
between GNU and NonGNU, but I think they're very fuzzy and to a large
extent they can be seen as a consequence of the copyright paperwork
(which makes it possible to imagine the package as being part of Emacs,
for example, thus justifying their presence in Debbugs).


        Stefan






^ permalink raw reply	[relevance 5%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  2023-09-08 17:10  5%                             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-09 10:01  5%                               ` Ihor Radchenko
  2023-09-09 10:15  0%                                 ` Daniel Mendler
  0 siblings, 1 reply; 200+ results
From: Ihor Radchenko @ 2023-09-09 10:01 UTC (permalink / raw)
  To: Joseph Turner
  Cc: 63513-done, Daniel Mendler, Stefan Monnier, Adam Porter,
	Eli Zaretskii, phillip.lord

Joseph Turner <joseph@breatheoutbreathe.in> writes:

>> Then, wouldn't it be better to contribute this function to compat.el and
>> use it from there?
>
> The new behavior of copy-tree has already been added to compat.el:
>
> https://github.com/emacs-compat/compat/pull/25
>
> However, that change currently only exists in compat's emacs-30 branch.

I see.

> I did not know if it was acceptable for persist.el to require compat
> when I wrote these patches. If we agree that it is acceptable, then I'm
> happy to submit a patch to replace (persist-copy-tree ...) with
> (compat-call copy-tree ...), but we'll have to wait to apply the patch
> until after the compat.el emacs-30 branch is merged into master.

AFAIU, the recommended way to implement compat function definitions that
are not yet added to compat.el is using `compat-defun' + `compat-call'.
Then, one can simply drop `compat-defun' after the function is finally
release with compat.el without touching the rest of the code.

CCing Daniel.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>





^ permalink raw reply	[relevance 5%]

* bug#63513: [PATCH] Make persist-defvar work with records and hash tables
  2023-09-09 10:01  5%                               ` Ihor Radchenko
@ 2023-09-09 10:15  0%                                 ` Daniel Mendler
  0 siblings, 0 replies; 200+ results
From: Daniel Mendler @ 2023-09-09 10:15 UTC (permalink / raw)
  To: Ihor Radchenko, Joseph Turner
  Cc: Adam Porter, Eli Zaretskii, 63513-done, Stefan Monnier,
	phillip.lord

On 9/9/23 12:01, Ihor Radchenko wrote:
> Joseph Turner <joseph@breatheoutbreathe.in> writes:
> 
>>> Then, wouldn't it be better to contribute this function to compat.el and
>>> use it from there?
>>
>> The new behavior of copy-tree has already been added to compat.el:
>>
>> https://github.com/emacs-compat/compat/pull/25
>>
>> However, that change currently only exists in compat's emacs-30 branch.
> 
> I see.
>
>> I did not know if it was acceptable for persist.el to require compat
>> when I wrote these patches. If we agree that it is acceptable, then I'm
>> happy to submit a patch to replace (persist-copy-tree ...) with
>> (compat-call copy-tree ...), but we'll have to wait to apply the patch
>> until after the compat.el emacs-30 branch is merged into master.
> 
> AFAIU, the recommended way to implement compat function definitions that
> are not yet added to compat.el is using `compat-defun' + `compat-call'.
> Then, one can simply drop `compat-defun' after the function is finally
> release with compat.el without touching the rest of the code.

`compat-call` is meant to be used to call "extended functions", for
example functions with additional arguments. See the Compat manual for
details.

The macros from compat-macs.el (`compat-defun` etc.) are internal as
documented in the file compat-macs.el. These macros must not be used
outside Compat.

So using Compat here has to wait until compat-30.x is released.

Daniel





^ permalink raw reply	[relevance 0%]

* bug#65797: 29.0.92; func-arity should not return (0 . many) with apply-partially
  2023-09-08 18:20  0%         ` Eli Zaretskii
@ 2023-09-11 16:57  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-11 18:58  0%             ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-11 16:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Monnier, 65797


Eli Zaretskii <eliz@gnu.org> writes:

> I think one of the alternatives you proposed was backward-compatible
> (albeit not very elegant).  So my vote is for that alternative.

I'm in favor of the solution in the patch (from Stefan's suggestion):

> - Replace `&optional arg` with `&rest args` and pass those args via
>   `apply`, so the number of args passed doesn't depend on the function
>   but on the caller.

The "&rest args" solution is clean and hack-free. It breaks
compatibility, but in unlikely cases:

- CONDITION pred accepts only a buffer argument, but additional ARG was
  passed (why would you do this?)

- CONDITION pred accepts two arguments, and no ARG was passed (this code
  would be broken anyway, right?)

Since buffer-match-p is new in Emacs 29, is it acceptable to assume that
code affected by this breakage can be updated?

Joseph





^ permalink raw reply	[relevance 5%]

* bug#65797: 29.0.92; func-arity should not return (0 . many) with apply-partially
  2023-09-11 16:57  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-11 18:58  0%             ` Eli Zaretskii
  0 siblings, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-09-11 18:58 UTC (permalink / raw)
  To: Joseph Turner; +Cc: monnier, 65797

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 65797@debbugs.gnu.org
> Date: Mon, 11 Sep 2023 09:57:51 -0700
> 
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > I think one of the alternatives you proposed was backward-compatible
> > (albeit not very elegant).  So my vote is for that alternative.
> 
> I'm in favor of the solution in the patch (from Stefan's suggestion):
> 
> > - Replace `&optional arg` with `&rest args` and pass those args via
> >   `apply`, so the number of args passed doesn't depend on the function
> >   but on the caller.
> 
> The "&rest args" solution is clean and hack-free. It breaks
> compatibility, but in unlikely cases:
> 
> - CONDITION pred accepts only a buffer argument, but additional ARG was
>   passed (why would you do this?)
> 
> - CONDITION pred accepts two arguments, and no ARG was passed (this code
>   would be broken anyway, right?)
> 
> Since buffer-match-p is new in Emacs 29, is it acceptable to assume that
> code affected by this breakage can be updated?

We have an alternative that doesn't break any compatibility, so I
think it is preferred.





^ permalink raw reply	[relevance 0%]

* bug#65797: `buffer-match-p` should not use `func-arity`
  @ 2023-09-15 17:54  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-15 18:00  5%             ` Dmitry Gutov
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-15 17:54 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Philip Kaludercic, Stefan Monnier, 65797


Dmitry Gutov <dmitry@gutov.dev> writes:

> BTW, do we want to change '&optional ARG' to '&rest ARGS'? I don't
> have a use case in mind, but this would be the most flexible.

Like this?

https://yhetil.org/emacs-bugs/jwvv8cmdmzz.fsf-monnier+emacs@gnu.org/T/#mc073d249234777e6f04d809e7107c1893c7f6b2d





^ permalink raw reply	[relevance 5%]

* bug#65797: `buffer-match-p` should not use `func-arity`
  2023-09-15 17:54  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-15 18:00  5%             ` Dmitry Gutov
  0 siblings, 0 replies; 200+ results
From: Dmitry Gutov @ 2023-09-15 18:00 UTC (permalink / raw)
  To: Joseph Turner; +Cc: Philip Kaludercic, Stefan Monnier, 65797

On 15/09/2023 20:54, Joseph Turner wrote:
> Dmitry Gutov<dmitry@gutov.dev>  writes:
> 
>> BTW, do we want to change '&optional ARG' to '&rest ARGS'? I don't
>> have a use case in mind, but this would be the most flexible.
> Like this?
> 
> https://yhetil.org/emacs-bugs/jwvv8cmdmzz.fsf-monnier+emacs@gnu.org/T/#mc073d249234777e6f04d809e7107c1893c7f6b2d

Pretty much. Sorry for the repetition.





^ permalink raw reply	[relevance 5%]

* bug#65768: Bump persist.el version
  2023-09-06 16:39  5% ` Stefan Kangas
@ 2023-09-16 22:28  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-30 14:30 11%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-16 22:28 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Phillip Lord, 65768

Ping.





^ permalink raw reply	[relevance 5%]

* bug#66114: [PATCH] Fix interactive prompt for selecting checkout directory
@ 2023-09-20  7:02  9% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
       [not found]     ` <handler.66114.B.16951935749180.ack@debbugs.gnu.org>
  2023-09-22  8:21  5% ` bug#66114: [PATCH] Fix interactive prompt for selecting checkout directory Philip Kaludercic
  0 siblings, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-20  7:02 UTC (permalink / raw)
  To: 66114; +Cc: Philip Kaludercic

[-- Attachment #1: Type: text/plain, Size: 110 bytes --]

Tags: patch

This patch fixes the interactive prompt in package-vc-checkout. See
commit message for details.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-interactive-prompt-for-selecting-checkout-direct.patch --]
[-- Type: text/patch, Size: 2213 bytes --]

From 70061d76542968575555f247d4715d18ed3c4e75 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 19 Sep 2023 23:58:43 -0700
Subject: [PATCH] Fix interactive prompt for selecting checkout directory

* lisp/emacs-lisp/package-vc.el (package-vc-checkout): Use
read-directory-name instead of read-file-name with
predicate.  Previously, it was impossible to interactively navigate to
a nested subdirectory.
---
 lisp/emacs-lisp/package-vc.el | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index c7a30736e32..29b540d86b8 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -823,12 +823,17 @@ repository.  If REV has the special value
 `:last-release' (interactively, the prefix argument), that stands
 for the last released version of the package."
   (interactive
-   (let* ((name (package-vc--read-package-name "Fetch package source: ")))
-     (list (cadr (assoc name package-archive-contents #'string=))
-           (read-file-name "Clone into new or empty directory: " nil nil t nil
-                           (lambda (dir) (or (not (file-exists-p dir))
-                                             (directory-empty-p dir))))
-           (and current-prefix-arg :last-release))))
+   (let* ((name (package-vc--read-package-name "Fetch package source: "))
+          (desc (cadr (assoc name package-archive-contents #'string=)))
+          (dir (read-directory-name "Clone into new or empty directory: ")))
+     (unless (or (not (file-exists-p dir))
+                 (directory-empty-p dir))
+       (let ((subdir (expand-file-name (package-desc-full-name desc) dir)))
+         (if (and (not (file-exists-p subdir))
+                  (y-or-n-p (format "Create new directory %s ?" subdir)))
+             (setf dir subdir)
+           (user-error "Directory not empty: %S" (expand-file-name dir)))))
+     (list desc dir (and current-prefix-arg :last-release))))
   (package-vc--archives-initialize)
   (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
                       (and-let* ((extras (package-desc-extras pkg-desc))
-- 
2.41.0


^ permalink raw reply related	[relevance 9%]

* bug#66115: [PATCH] Ensure that directory is expanded in package-vc-checkout
@ 2023-09-20  7:14 10% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-22  8:17  5% ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-20  7:14 UTC (permalink / raw)
  To: 66115; +Cc: Philip Kaludercic

[-- Attachment #1: Type: text/plain, Size: 163 bytes --]

Tags: patch

Tags: patch

This patch fixes a serious bug which caused package-vc-checkout to fail
entirely when its second argument `directory' was not expanded.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Ensure-that-directory-is-expanded-in-package-vc-chec.patch --]
[-- Type: text/patch, Size: 1015 bytes --]

From 75a6ec74ff5e31edc7592b68e7ad9d1ec26f515c Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Wed, 20 Sep 2023 00:12:10 -0700
Subject: [PATCH] Ensure that directory is expanded in package-vc-checkout

* lisp/emacs-lisp/package-vc.el (package-vc-checkout)
---
 lisp/emacs-lisp/package-vc.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index 29b540d86b8..47d8c996ff0 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -834,6 +834,7 @@ for the last released version of the package."
              (setf dir subdir)
            (user-error "Directory not empty: %S" (expand-file-name dir)))))
      (list desc dir (and current-prefix-arg :last-release))))
+  (setf directory (expand-file-name directory))
   (package-vc--archives-initialize)
   (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
                       (and-let* ((extras (package-desc-extras pkg-desc))
-- 
2.41.0


^ permalink raw reply related	[relevance 10%]

* bug#66114: Acknowledgement ([PATCH] Fix interactive prompt for selecting checkout directory)
       [not found]     ` <handler.66114.B.16951935749180.ack@debbugs.gnu.org>
@ 2023-09-20  7:24  9%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-20  7:31  9%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-20  7:24 UTC (permalink / raw)
  To: 66114

[-- Attachment #1: Type: text/plain, Size: 63 bytes --]

In this updated patch, I didn't not remove a double negative.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-interactive-prompt-for-selecting-checkout-direct.patch --]
[-- Type: text/x-diff, Size: 2209 bytes --]

From cc5d53e59928747b324eef312a4c83266a3bb8c3 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 19 Sep 2023 23:58:43 -0700
Subject: [PATCH] Fix interactive prompt for selecting checkout directory

* lisp/emacs-lisp/package-vc.el (package-vc-checkout): Use
read-directory-name instead of read-file-name with
predicate.  Previously, it was impossible to interactively navigate to
a nested subdirectory.
---
 lisp/emacs-lisp/package-vc.el | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index c7a30736e32..9caa1931af8 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -823,12 +823,17 @@ repository.  If REV has the special value
 `:last-release' (interactively, the prefix argument), that stands
 for the last released version of the package."
   (interactive
-   (let* ((name (package-vc--read-package-name "Fetch package source: ")))
-     (list (cadr (assoc name package-archive-contents #'string=))
-           (read-file-name "Clone into new or empty directory: " nil nil t nil
-                           (lambda (dir) (or (not (file-exists-p dir))
-                                             (directory-empty-p dir))))
-           (and current-prefix-arg :last-release))))
+   (let* ((name (package-vc--read-package-name "Fetch package source: "))
+          (desc (cadr (assoc name package-archive-contents #'string=)))
+          (dir (read-directory-name "Clone into new or empty directory: ")))
+     (when (or (file-exists-p dir)
+               (not (directory-empty-p dir)))
+       (let ((subdir (expand-file-name (package-desc-full-name desc) dir)))
+         (if (and (not (file-exists-p subdir))
+                  (y-or-n-p (format "Create new directory %s ?" subdir)))
+             (setf dir subdir)
+           (user-error "Directory not empty: %S" (expand-file-name dir)))))
+     (list desc dir (and current-prefix-arg :last-release))))
   (package-vc--archives-initialize)
   (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
                       (and-let* ((extras (package-desc-extras pkg-desc))
-- 
2.41.0


^ permalink raw reply related	[relevance 9%]

* bug#66114: Acknowledgement ([PATCH] Fix interactive prompt for selecting checkout directory)
  2023-09-20  7:24  9%   ` bug#66114: Acknowledgement ([PATCH] Fix interactive prompt for selecting checkout directory) Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-20  7:31  9%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-20  7:31 UTC (permalink / raw)
  To: 66114

[-- Attachment #1: Type: text/plain, Size: 96 bytes --]

Oops! I forgot how contrapositives work for a moment.

Please ignore the previous two patches.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-interactive-prompt-for-selecting-checkout-direct.patch --]
[-- Type: text/x-diff, Size: 2193 bytes --]

From aa3aca16755a8edec8d761e28d4ad0125cc5b7cd Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 19 Sep 2023 23:58:43 -0700
Subject: [PATCH] Fix interactive prompt for selecting checkout directory

* lisp/emacs-lisp/package-vc.el (package-vc-checkout): Use
read-directory-name instead of read-file-name with
predicate.  Previously, it was impossible to interactively navigate to
a nested subdirectory.
---
 lisp/emacs-lisp/package-vc.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index c7a30736e32..14014a84448 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -823,12 +823,16 @@ repository.  If REV has the special value
 `:last-release' (interactively, the prefix argument), that stands
 for the last released version of the package."
   (interactive
-   (let* ((name (package-vc--read-package-name "Fetch package source: ")))
-     (list (cadr (assoc name package-archive-contents #'string=))
-           (read-file-name "Clone into new or empty directory: " nil nil t nil
-                           (lambda (dir) (or (not (file-exists-p dir))
-                                             (directory-empty-p dir))))
-           (and current-prefix-arg :last-release))))
+   (let* ((name (package-vc--read-package-name "Fetch package source: "))
+          (desc (cadr (assoc name package-archive-contents #'string=)))
+          (dir (read-directory-name "Clone into new or empty directory: ")))
+     (when (and (file-exists-p dir) (not (directory-empty-p dir)))
+       (let ((subdir (expand-file-name (package-desc-full-name desc) dir)))
+         (if (and (not (file-exists-p subdir))
+                  (y-or-n-p (format "Create new directory %s ?" subdir)))
+             (setf dir subdir)
+           (user-error "Directory not empty: %S" (expand-file-name dir)))))
+     (list desc dir (and current-prefix-arg :last-release))))
   (package-vc--archives-initialize)
   (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
                       (and-let* ((extras (package-desc-extras pkg-desc))
-- 
2.41.0


^ permalink raw reply related	[relevance 9%]

* bug#66115: [PATCH] Ensure that directory is expanded in package-vc-checkout
  2023-09-20  7:14 10% bug#66115: [PATCH] Ensure that directory is expanded in package-vc-checkout Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-22  8:17  5% ` Philip Kaludercic
  2023-09-22  8:33  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-09-22  8:17 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 66115

[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Tags: patch
>
> Tags: patch
>
> This patch fixes a serious bug which caused package-vc-checkout to fail
> entirely when its second argument `directory' was not expanded.
>
> From 75a6ec74ff5e31edc7592b68e7ad9d1ec26f515c Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Wed, 20 Sep 2023 00:12:10 -0700
> Subject: [PATCH] Ensure that directory is expanded in package-vc-checkout
>
> * lisp/emacs-lisp/package-vc.el (package-vc-checkout)
> ---
>  lisp/emacs-lisp/package-vc.el | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index 29b540d86b8..47d8c996ff0 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -834,6 +834,7 @@ for the last released version of the package."
>               (setf dir subdir)
>             (user-error "Directory not empty: %S" (expand-file-name dir)))))
>       (list desc dir (and current-prefix-arg :last-release))))
> +  (setf directory (expand-file-name directory))
>    (package-vc--archives-initialize)
>    (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
>                        (and-let* ((extras (package-desc-extras pkg-desc))

DIRECTORY is passed on to `package-vc--clone' and in turn `vc-clone'.
Wouldn't it be more robust to ensure that `vc-clone' can handle
unexpanded directory names, eg. like this:


[-- Attachment #2: Type: text/plain, Size: 549 bytes --]

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 2f4b028bb4a..7f334397a5e 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -3676,8 +3676,7 @@ vc-clone
 checkout.  If BACKEND is nil, iterate through every known backend
 in `vc-handled-backends' until one succeeds.  If REV is non-nil,
 it indicates a specific revision to check out."
-  (unless directory
-    (setq directory default-directory))
+  (setq directory (expand-file-name (or directory default-directory)))
   (if backend
       (progn
         (unless (memq backend vc-handled-backends)

^ permalink raw reply related	[relevance 5%]

* bug#66114: [PATCH] Fix interactive prompt for selecting checkout directory
  2023-09-20  7:02  9% bug#66114: [PATCH] Fix interactive prompt for selecting checkout directory Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
       [not found]     ` <handler.66114.B.16951935749180.ack@debbugs.gnu.org>
@ 2023-09-22  8:21  5% ` Philip Kaludercic
  2023-09-24  5:06  4%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-09-22  8:21 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 66114

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Tags: patch
>
> This patch fixes the interactive prompt in package-vc-checkout. See
> commit message for details.
>
> From 70061d76542968575555f247d4715d18ed3c4e75 Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Tue, 19 Sep 2023 23:58:43 -0700
> Subject: [PATCH] Fix interactive prompt for selecting checkout directory
>
> * lisp/emacs-lisp/package-vc.el (package-vc-checkout): Use
> read-directory-name instead of read-file-name with
> predicate.  Previously, it was impossible to interactively navigate to
> a nested subdirectory.

I can "navigate" into whatever directory I want, but I don't get completion.

> ---
>  lisp/emacs-lisp/package-vc.el | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index c7a30736e32..29b540d86b8 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -823,12 +823,17 @@ repository.  If REV has the special value
>  `:last-release' (interactively, the prefix argument), that stands
>  for the last released version of the package."
>    (interactive
> -   (let* ((name (package-vc--read-package-name "Fetch package source: ")))
> -     (list (cadr (assoc name package-archive-contents #'string=))
> -           (read-file-name "Clone into new or empty directory: " nil nil t nil
> -                           (lambda (dir) (or (not (file-exists-p dir))
> -                                             (directory-empty-p dir))))
> -           (and current-prefix-arg :last-release))))
> +   (let* ((name (package-vc--read-package-name "Fetch package source: "))
> +          (desc (cadr (assoc name package-archive-contents #'string=)))
> +          (dir (read-directory-name "Clone into new or empty directory: ")))
> +     (unless (or (not (file-exists-p dir))
> +                 (directory-empty-p dir))
> +       (let ((subdir (expand-file-name (package-desc-full-name desc) dir)))
> +         (if (and (not (file-exists-p subdir))
> +                  (y-or-n-p (format "Create new directory %s ?" subdir)))
> +             (setf dir subdir)

I'd prefer to use a setq here.

> +           (user-error "Directory not empty: %S" (expand-file-name dir)))))

This seems like an anti-feature to me, because you need to know what
directory is empty before confirming your choice, and if it is not
empty, you have to restart the entire command again.

> +     (list desc dir (and current-prefix-arg :last-release))))
>    (package-vc--archives-initialize)
>    (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
>                        (and-let* ((extras (package-desc-extras pkg-desc))





^ permalink raw reply	[relevance 5%]

* bug#66115: [PATCH] Ensure that directory is expanded in package-vc-checkout
  2023-09-22  8:17  5% ` Philip Kaludercic
@ 2023-09-22  8:33  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-22 10:51  5%     ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-22  8:33 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 66115


Philip Kaludercic <philipk@posteo.net> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Tags: patch
>>
>> Tags: patch
>>
>> This patch fixes a serious bug which caused package-vc-checkout to fail
>> entirely when its second argument `directory' was not expanded.
>>
>> From 75a6ec74ff5e31edc7592b68e7ad9d1ec26f515c Mon Sep 17 00:00:00 2001
>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Date: Wed, 20 Sep 2023 00:12:10 -0700
>> Subject: [PATCH] Ensure that directory is expanded in package-vc-checkout
>>
>> * lisp/emacs-lisp/package-vc.el (package-vc-checkout)
>> ---
>>  lisp/emacs-lisp/package-vc.el | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>> index 29b540d86b8..47d8c996ff0 100644
>> --- a/lisp/emacs-lisp/package-vc.el
>> +++ b/lisp/emacs-lisp/package-vc.el
>> @@ -834,6 +834,7 @@ for the last released version of the package."
>>               (setf dir subdir)
>>             (user-error "Directory not empty: %S" (expand-file-name dir)))))
>>       (list desc dir (and current-prefix-arg :last-release))))
>> +  (setf directory (expand-file-name directory))
>>    (package-vc--archives-initialize)
>>    (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
>>                        (and-let* ((extras (package-desc-extras pkg-desc))
>
> DIRECTORY is passed on to `package-vc--clone' and in turn `vc-clone'.
> Wouldn't it be more robust to ensure that `vc-clone' can handle
> unexpanded directory names, eg. like this:
>
> diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
> index 2f4b028bb4a..7f334397a5e 100644
> --- a/lisp/vc/vc.el
> +++ b/lisp/vc/vc.el
> @@ -3676,8 +3676,7 @@ vc-clone
>  checkout.  If BACKEND is nil, iterate through every known backend
>  in `vc-handled-backends' until one succeeds.  If REV is non-nil,
>  it indicates a specific revision to check out."
> -  (unless directory
> -    (setq directory default-directory))
> +  (setq directory (expand-file-name (or directory default-directory)))
>    (if backend
>        (progn
>          (unless (memq backend vc-handled-backends)

Yes, certainly. Your solution is better.





^ permalink raw reply	[relevance 5%]

* bug#66115: [PATCH] Ensure that directory is expanded in package-vc-checkout
  2023-09-22  8:33  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-22 10:51  5%     ` Philip Kaludercic
  2023-09-24  5:34  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-09-22 10:51 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 66115-done

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>
>>> Tags: patch
>>>
>>> Tags: patch
>>>
>>> This patch fixes a serious bug which caused package-vc-checkout to fail
>>> entirely when its second argument `directory' was not expanded.
>>>
>>> From 75a6ec74ff5e31edc7592b68e7ad9d1ec26f515c Mon Sep 17 00:00:00 2001
>>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>>> Date: Wed, 20 Sep 2023 00:12:10 -0700
>>> Subject: [PATCH] Ensure that directory is expanded in package-vc-checkout
>>>
>>> * lisp/emacs-lisp/package-vc.el (package-vc-checkout)
>>> ---
>>>  lisp/emacs-lisp/package-vc.el | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>>> index 29b540d86b8..47d8c996ff0 100644
>>> --- a/lisp/emacs-lisp/package-vc.el
>>> +++ b/lisp/emacs-lisp/package-vc.el
>>> @@ -834,6 +834,7 @@ for the last released version of the package."
>>>               (setf dir subdir)
>>>             (user-error "Directory not empty: %S" (expand-file-name dir)))))
>>>       (list desc dir (and current-prefix-arg :last-release))))
>>> +  (setf directory (expand-file-name directory))
>>>    (package-vc--archives-initialize)
>>>    (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
>>>                        (and-let* ((extras (package-desc-extras pkg-desc))
>>
>> DIRECTORY is passed on to `package-vc--clone' and in turn `vc-clone'.
>> Wouldn't it be more robust to ensure that `vc-clone' can handle
>> unexpanded directory names, eg. like this:
>>
>> diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
>> index 2f4b028bb4a..7f334397a5e 100644
>> --- a/lisp/vc/vc.el
>> +++ b/lisp/vc/vc.el
>> @@ -3676,8 +3676,7 @@ vc-clone
>>  checkout.  If BACKEND is nil, iterate through every known backend
>>  in `vc-handled-backends' until one succeeds.  If REV is non-nil,
>>  it indicates a specific revision to check out."
>> -  (unless directory
>> -    (setq directory default-directory))
>> +  (setq directory (expand-file-name (or directory default-directory)))
>>    (if backend
>>        (progn
>>          (unless (memq backend vc-handled-backends)
>
> Yes, certainly. Your solution is better.

OK, closing the issue.





^ permalink raw reply	[relevance 5%]

* bug#66114: [PATCH] Fix interactive prompt for selecting checkout directory
  2023-09-22  8:21  5% ` bug#66114: [PATCH] Fix interactive prompt for selecting checkout directory Philip Kaludercic
@ 2023-09-24  5:06  4%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-24 14:37  5%     ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-24  5:06 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 66114


Philip Kaludercic <philipk@posteo.net> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Tags: patch
>>
>> This patch fixes the interactive prompt in package-vc-checkout. See
>> commit message for details.
>>
>> From 70061d76542968575555f247d4715d18ed3c4e75 Mon Sep 17 00:00:00 2001
>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Date: Tue, 19 Sep 2023 23:58:43 -0700
>> Subject: [PATCH] Fix interactive prompt for selecting checkout directory
>>
>> * lisp/emacs-lisp/package-vc.el (package-vc-checkout): Use
>> read-directory-name instead of read-file-name with
>> predicate.  Previously, it was impossible to interactively navigate to
>> a nested subdirectory.
>
> I can "navigate" into whatever directory I want, but I don't get completion.

You're right.

>> ---
>>  lisp/emacs-lisp/package-vc.el | 17 +++++++++++------
>>  1 file changed, 11 insertions(+), 6 deletions(-)
>>
>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>> index c7a30736e32..29b540d86b8 100644
>> --- a/lisp/emacs-lisp/package-vc.el
>> +++ b/lisp/emacs-lisp/package-vc.el
>> @@ -823,12 +823,17 @@ repository.  If REV has the special value
>>  `:last-release' (interactively, the prefix argument), that stands
>>  for the last released version of the package."
>>    (interactive
>> -   (let* ((name (package-vc--read-package-name "Fetch package source: ")))
>> -     (list (cadr (assoc name package-archive-contents #'string=))
>> -           (read-file-name "Clone into new or empty directory: " nil nil t nil
>> -                           (lambda (dir) (or (not (file-exists-p dir))
>> -                                             (directory-empty-p dir))))
>> -           (and current-prefix-arg :last-release))))
>> +   (let* ((name (package-vc--read-package-name "Fetch package source: "))
>> +          (desc (cadr (assoc name package-archive-contents #'string=)))
>> +          (dir (read-directory-name "Clone into new or empty directory: ")))
>> +     (unless (or (not (file-exists-p dir))
>> +                 (directory-empty-p dir))
>> +       (let ((subdir (expand-file-name (package-desc-full-name desc) dir)))
>> +         (if (and (not (file-exists-p subdir))
>> +                  (y-or-n-p (format "Create new directory %s ?" subdir)))
>> +             (setf dir subdir)
>
> I'd prefer to use a setq here.
>
>> +           (user-error "Directory not empty: %S" (expand-file-name dir)))))
>
> This seems like an anti-feature to me, because you need to know what
> directory is empty before confirming your choice, and if it is not
> empty, you have to restart the entire command again.

Yes, I agree.

IIUC, we want to read from the user a directory which is either
nonexistent or empty.  However, we also want the completions to include
non-empty directories so that the user can easily select a deeply nested
directory.  The current solution does not offer non-empty directories for
completions, meaning that users must manually type in a potentially long
path to a nested empty or nonexistent directory.

Here's a different idea I tried:

(read-file-name "Clone into new or empty directory: " nil nil
                ;; Must match a nonexistent or empty directory
                (lambda (dir) (or (not (file-exists-p dir))
                                  (directory-empty-p dir)))
                nil
                ;; `read-directory-name' accepts no PREDICATE
                ;; argument: hack `read-file-name' instead.
                (lambda (file-name) (file-directory-p file-name)))

but this erroneously returns the default filename, which might be
buffer-file-name or whatever string is currently in the minibuffer.

I would have expected that when MUSTMATCH is a function and it returns
nil, a "[Match required]" message would appear.  However, the behavior of
read-file-name is unspecified when a MUSTMATCH function returns nil:

- a function, which will be called with the input as the
  argument.  If the function returns a non-nil value, the
  minibuffer is exited with that argument as the value.

Is this a bug, a case of under-documentation, or do I misunderstand something?

I'm happy to post this in a separate bug thread if you think it's worth it.

Joseph

>> +     (list desc dir (and current-prefix-arg :last-release))))
>>    (package-vc--archives-initialize)
>>    (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
>>                        (and-let* ((extras (package-desc-extras pkg-desc))





^ permalink raw reply	[relevance 4%]

* bug#66115: [PATCH] Ensure that directory is expanded in package-vc-checkout
  2023-09-22 10:51  5%     ` Philip Kaludercic
@ 2023-09-24  5:34  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-24  6:54  0%         ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-24  5:34 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 66115-done

It appears that the fix was applied to master. Would it make sense to
apply it to emacs-29?





^ permalink raw reply	[relevance 5%]

* bug#66115: [PATCH] Ensure that directory is expanded in package-vc-checkout
  2023-09-24  5:34  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-24  6:54  0%         ` Eli Zaretskii
  0 siblings, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-09-24  6:54 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 66115, philipk

> Cc: 66115-done@debbugs.gnu.org
> Date: Sat, 23 Sep 2023 22:34:24 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> It appears that the fix was applied to master. Would it make sense to
> apply it to emacs-29?

The installed change affects much more than the original issue, so I'd
prefer for it to stay on master.

I'm okay with installing the original patch on emacs-29, but be sure
to say "do not merge to master" in the commit log message if you do.





^ permalink raw reply	[relevance 0%]

* bug#66114: [PATCH] Fix interactive prompt for selecting checkout directory
  2023-09-24  5:06  4%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-24 14:37  5%     ` Philip Kaludercic
  2023-09-24 21:27  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Philip Kaludercic @ 2023-09-24 14:37 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 66114

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>
>>> Tags: patch
>>>
>>> This patch fixes the interactive prompt in package-vc-checkout. See
>>> commit message for details.
>>>
>>> From 70061d76542968575555f247d4715d18ed3c4e75 Mon Sep 17 00:00:00 2001
>>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>>> Date: Tue, 19 Sep 2023 23:58:43 -0700
>>> Subject: [PATCH] Fix interactive prompt for selecting checkout directory
>>>
>>> * lisp/emacs-lisp/package-vc.el (package-vc-checkout): Use
>>> read-directory-name instead of read-file-name with
>>> predicate.  Previously, it was impossible to interactively navigate to
>>> a nested subdirectory.
>>
>> I can "navigate" into whatever directory I want, but I don't get completion.
>
> You're right.
>
>>> ---
>>>  lisp/emacs-lisp/package-vc.el | 17 +++++++++++------
>>>  1 file changed, 11 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>>> index c7a30736e32..29b540d86b8 100644
>>> --- a/lisp/emacs-lisp/package-vc.el
>>> +++ b/lisp/emacs-lisp/package-vc.el
>>> @@ -823,12 +823,17 @@ repository.  If REV has the special value
>>>  `:last-release' (interactively, the prefix argument), that stands
>>>  for the last released version of the package."
>>>    (interactive
>>> -   (let* ((name (package-vc--read-package-name "Fetch package source: ")))
>>> -     (list (cadr (assoc name package-archive-contents #'string=))
>>> -           (read-file-name "Clone into new or empty directory: " nil nil t nil
>>> -                           (lambda (dir) (or (not (file-exists-p dir))
>>> -                                             (directory-empty-p dir))))
>>> -           (and current-prefix-arg :last-release))))
>>> +   (let* ((name (package-vc--read-package-name "Fetch package source: "))
>>> +          (desc (cadr (assoc name package-archive-contents #'string=)))
>>> +          (dir (read-directory-name "Clone into new or empty directory: ")))
>>> +     (unless (or (not (file-exists-p dir))
>>> +                 (directory-empty-p dir))
>>> +       (let ((subdir (expand-file-name (package-desc-full-name desc) dir)))
>>> +         (if (and (not (file-exists-p subdir))
>>> +                  (y-or-n-p (format "Create new directory %s ?" subdir)))
>>> +             (setf dir subdir)
>>
>> I'd prefer to use a setq here.
>>
>>> +           (user-error "Directory not empty: %S" (expand-file-name dir)))))
>>
>> This seems like an anti-feature to me, because you need to know what
>> directory is empty before confirming your choice, and if it is not
>> empty, you have to restart the entire command again.
>
> Yes, I agree.
>
> IIUC, we want to read from the user a directory which is either
> nonexistent or empty.  However, we also want the completions to include
> non-empty directories so that the user can easily select a deeply nested
> directory.  The current solution does not offer non-empty directories for
> completions, meaning that users must manually type in a potentially long
> path to a nested empty or nonexistent directory.

It is funny to me, that I probably never noticed this issue because I
have the habit of using hippie-expand to complete partial file names,
including in the minibuffer :)

> Here's a different idea I tried:
>
> (read-file-name "Clone into new or empty directory: " nil nil
>                 ;; Must match a nonexistent or empty directory
>                 (lambda (dir) (or (not (file-exists-p dir))
>                                   (directory-empty-p dir)))
>                 nil
>                 ;; `read-directory-name' accepts no PREDICATE
>                 ;; argument: hack `read-file-name' instead.
>                 (lambda (file-name) (file-directory-p file-name)))
>
> but this erroneously returns the default filename, which might be
> buffer-file-name or whatever string is currently in the minibuffer.

An issue I am observing, is that it allows selecting non-empty
directories.

> I would have expected that when MUSTMATCH is a function and it returns
> nil, a "[Match required]" message would appear.  

For the record, what completion system are you using.  I don't appear to
see this message at all.

>                                                  However, the behavior of
> read-file-name is unspecified when a MUSTMATCH function returns nil:
>
> - a function, which will be called with the input as the
>   argument.  If the function returns a non-nil value, the
>   minibuffer is exited with that argument as the value.
>
> Is this a bug, a case of under-documentation, or do I misunderstand something?
>
> I'm happy to post this in a separate bug thread if you think it's worth it.

Perhaps that would be worth doing, that way the people who know more
about completion than I do would be more likely to see it and help out.

>
> Joseph
>
>>> +     (list desc dir (and current-prefix-arg :last-release))))
>>>    (package-vc--archives-initialize)
>>>    (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
>>>                        (and-let* ((extras (package-desc-extras pkg-desc))

-- 
Philip Kaludercic





^ permalink raw reply	[relevance 5%]

* bug#66114: [PATCH] Fix interactive prompt for selecting checkout directory
  2023-09-24 14:37  5%     ` Philip Kaludercic
@ 2023-09-24 21:27  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-24 21:27 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 66114


Philip Kaludercic <philipk@posteo.net> writes:

> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>
>> Philip Kaludercic <philipk@posteo.net> writes:
>>
>>> Joseph Turner <joseph@breatheoutbreathe.in> writes:
>>>
>>>> Tags: patch
>>>>
>>>> This patch fixes the interactive prompt in package-vc-checkout.
>>>> See
>>>> commit message for details.
>>>>
>>>> From 70061d76542968575555f247d4715d18ed3c4e75 Mon Sep 17 00:00:00
>>>> 2001
>>>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>>>> Date: Tue, 19 Sep 2023 23:58:43 -0700
>>>> Subject: [PATCH] Fix interactive prompt for selecting checkout
>>>> directory
>>>>
>>>> * lisp/emacs-lisp/package-vc.el (package-vc-checkout): Use
>>>> read-directory-name instead of read-file-name with
>>>> predicate. Previously, it was impossible to interactively navigate
>>>> to
>>>> a nested subdirectory.
>>>
>>> I can "navigate" into whatever directory I want, but I don't get
>>> completion.
>>
>> You're right.
>>
>>>> ---
>>>>  lisp/emacs-lisp/package-vc.el | 17 +++++++++++------
>>>>  1 file changed, 11 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
>>>> index c7a30736e32..29b540d86b8 100644
>>>> --- a/lisp/emacs-lisp/package-vc.el
>>>> +++ b/lisp/emacs-lisp/package-vc.el
>>>> @@ -823,12 +823,17 @@ repository.  If REV has the special value
>>>>  `:last-release' (interactively, the prefix argument), that stands
>>>>  for the last released version of the package."
>>>>    (interactive
>>>> -   (let* ((name (package-vc--read-package-name "Fetch package source: ")))
>>>> -     (list (cadr (assoc name package-archive-contents #'string=))
>>>> -           (read-file-name "Clone into new or empty directory: " nil nil t nil
>>>> -                           (lambda (dir) (or (not (file-exists-p dir))
>>>> -                                             (directory-empty-p dir))))
>>>> -           (and current-prefix-arg :last-release))))
>>>> +   (let* ((name (package-vc--read-package-name "Fetch package source: "))
>>>> +          (desc (cadr (assoc name package-archive-contents #'string=)))
>>>> +          (dir (read-directory-name "Clone into new or empty directory: ")))
>>>> +     (unless (or (not (file-exists-p dir))
>>>> +                 (directory-empty-p dir))
>>>> +       (let ((subdir (expand-file-name (package-desc-full-name desc) dir)))
>>>> +         (if (and (not (file-exists-p subdir))
>>>> +                  (y-or-n-p (format "Create new directory %s ?" subdir)))
>>>> +             (setf dir subdir)
>>>
>>> I'd prefer to use a setq here.
>>>
>>>> + (user-error "Directory not empty: %S" (expand-file-name dir)))))
>>>
>>> This seems like an anti-feature to me, because you need to know
>>> what
>>> directory is empty before confirming your choice, and if it is not
>>> empty, you have to restart the entire command again.
>>
>> Yes, I agree.
>>
>> IIUC, we want to read from the user a directory which is either
>> nonexistent or empty. However, we also want the completions to
>> include
>> non-empty directories so that the user can easily select a deeply
>> nested
>> directory. The current solution does not offer non-empty directories
>> for
>> completions, meaning that users must manually type in a potentially
>> long
>> path to a nested empty or nonexistent directory.
>
> It is funny to me, that I probably never noticed this issue because I
> have the habit of using hippie-expand to complete partial file names,
> including in the minibuffer :)

Ah, that makes sense :)

>> Here's a different idea I tried:
>>
>> (read-file-name "Clone into new or empty directory: " nil nil
>>                 ;; Must match a nonexistent or empty directory
>>                 (lambda (dir) (or (not (file-exists-p dir))
>>                                   (directory-empty-p dir)))
>>                 nil
>>                 ;; `read-directory-name' accepts no PREDICATE
>>                 ;; argument: hack `read-file-name' instead.
>>                 (lambda (file-name) (file-directory-p file-name)))
>>
>> but this erroneously returns the default filename, which might be
>> buffer-file-name or whatever string is currently in the minibuffer.
>
> An issue I am observing, is that it allows selecting non-empty
> directories.
>
>> I would have expected that when MUSTMATCH is a function and it
>> returns
>> nil, a "[Match required]" message would appear.
>
> For the record, what completion system are you using. I don't appear
> to
> see this message at all.

I also do not see the message, but I expect to see it. I am using
vertico + orderless.

>>                                                  However, the behavior of
>> read-file-name is unspecified when a MUSTMATCH function returns nil:
>>
>> - a function, which will be called with the input as the
>>   argument.  If the function returns a non-nil value, the
>>   minibuffer is exited with that argument as the value.
>>
>> Is this a bug, a case of under-documentation, or do I misunderstand something?
>>
>> I'm happy to post this in a separate bug thread if you think it's worth it.
>
> Perhaps that would be worth doing, that way the people who know more
> about completion than I do would be more likely to see it and help
> out.

Okay, thanks! I'll do that.

>>
>> Joseph
>>
>>>> +     (list desc dir (and current-prefix-arg :last-release))))
>>>>    (package-vc--archives-initialize)
>>>>    (let ((pkg-spec (or (package-vc--desc->spec pkg-desc)
>>>>                        (and-let* ((extras (package-desc-extras pkg-desc))






^ permalink raw reply	[relevance 5%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
@ 2023-09-24 21:31  5% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-25  3:58  5% ` Michael Heerdegen
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-24 21:31 UTC (permalink / raw)
  To: 66187; +Cc: Philip Kaludercic

Hello!

When the MUSTMATCH argument to read-file-name is a function, I'd expect
to see a message like "[Match required]" when the function returns nil.

For example, I'd expect the following to never match:

(read-file-name "Prompt: " nil nil #'ignore)

The behavior of read-file-name is unspecified when a MUSTMATCH function
returns nil:

- a function, which will be called with the input as the
  argument.  If the function returns a non-nil value, the
  minibuffer is exited with that argument as the value.

Would someone kindly explain the intended behavior here?

This issue originally came up in this thread about package-vc-checkout:
https://yhetil.org/emacs-bugs/87v8bzi7iz.fsf@breatheoutbreathe.in/T/#m224de986dcc97f23e17386fb0dd2db4a513726bf

Thanks!

Joseph





^ permalink raw reply	[relevance 5%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-09-24 21:31  5% bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-25  3:58  5% ` Michael Heerdegen
  2023-09-25  5:12  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Michael Heerdegen @ 2023-09-25  3:58 UTC (permalink / raw)
  To: 66187; +Cc: philipk, joseph

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> Would someone kindly explain the intended behavior here?

I don't know, but I would expect that when the MUST-MATCH predicate
fails the behavior is the same as with MUST-MATCH t, and when it
succeeds, the behavior is like MUST-MATCH nil.  Quite simple I think.
Do you see something different?

Hmm - or, maybe the confusion is about the behavior for the members of
the collection?  With other words, whether the argument can be used to
restrict which existing files are matched, vs. whether it can only be
used to limit what additionally matches?  AFAIU the latter is the case -
existing files always match.

> This issue originally came up in this thread about package-vc-checkout:
> https://yhetil.org/emacs-bugs/87v8bzi7iz.fsf@breatheoutbreathe.in/T/#m224de986dcc97f23e17386fb0dd2db4a513726bf

I didn't understand the "this erroneously returns the default filename"
part.  What default filename is returned?

Michael.





^ permalink raw reply	[relevance 5%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-09-25  3:58  5% ` Michael Heerdegen
@ 2023-09-25  5:12  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-25 21:33  5%     ` Michael Heerdegen
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-25  5:12 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: philipk, 66187

Thanks for your help!!

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
>
>> Would someone kindly explain the intended behavior here?
>
> I don't know, but I would expect that when the MUST-MATCH predicate
> fails the behavior is the same as with MUST-MATCH t, and when it
> succeeds, the behavior is like MUST-MATCH nil.  Quite simple I think.
> Do you see something different?

Yes. In emacs -Q:

(mkdir "/tmp/foo" t)
(with-temp-buffer
  (write-file "/tmp/foo/bar"))
(setq default-directory "/tmp/foo/")
(read-file-name "Clone into new or empty directory: " nil nil
                (lambda (filename)
                  (or (not (file-exists-p filename))
                      (directory-empty-p filename)))
                nil
                (lambda (filename)
                  (file-directory-p filename)))

The default prompt is "/tmp/foo/". In my Emacs (29.0.92), when I
immediately press RET, read-file-name (erroneously?) returns "/tmp/foo/"
(which exists and is not empty) instead of saying "[Match required]".

Are you able to reproduce this on your machine?

> Hmm - or, maybe the confusion is about the behavior for the members of
> the collection?  With other words, whether the argument can be used to
> restrict which existing files are matched, vs. whether it can only be
> used to limit what additionally matches?  AFAIU the latter is the case -
> existing files always match.
>
>> This issue originally came up in this thread about package-vc-checkout:
>> https://yhetil.org/emacs-bugs/87v8bzi7iz.fsf@breatheoutbreathe.in/T/#m224de986dcc97f23e17386fb0dd2db4a513726bf
>
> I didn't understand the "this erroneously returns the default filename"
> part.  What default filename is returned?

Does my above comment answer this question?

Thank you!!

Joseph






^ permalink raw reply	[relevance 5%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-09-25  5:12  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-25 21:33  5%     ` Michael Heerdegen
  2023-09-26  8:37  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Michael Heerdegen @ 2023-09-25 21:33 UTC (permalink / raw)
  To: Joseph Turner; +Cc: philipk, 66187

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> (mkdir "/tmp/foo" t)
> (with-temp-buffer
>   (write-file "/tmp/foo/bar"))
> (setq default-directory "/tmp/foo/")
> (read-file-name "Clone into new or empty directory: " nil nil
>                 (lambda (filename)
>                   (or (not (file-exists-p filename))
>                       (directory-empty-p filename)))
>                 nil
>                 (lambda (filename)
>                   (file-directory-p filename)))
>
> The default prompt is "/tmp/foo/". In my Emacs (29.0.92), when I
> immediately press RET, read-file-name (erroneously?) returns "/tmp/foo/"
> (which exists and is not empty) instead of saying "[Match required]".
>
> Are you able to reproduce this on your machine?

Yes, I see the same.  But I think it's expected.  AFAIU the algorithm
works like this: first it's checked whether a completion is allowed (by
checking whether it's the name of an existing file and consulting
PREDICATE when specified).  Only when it is not allowed we check whether
MUSTMATCH declares it acceptable.

This is not really explained in the docstring, however.

In your example, the default-directory is the name of an existing file,
so the MUSTMATCH argument is irrelevant, the specified PREDICATE is
fulfilled, so it's accepted as input.

If I guess correctly I think you want something like this:

#+begin_src emacs-lisp
(let ((acceptable-p (lambda (filename)
                      (and (file-directory-p filename)
                           (directory-empty-p filename)))))
  (read-file-name "Clone into new or empty directory: " nil nil
                  (lambda (filename)
                    (if (file-exists-p filename)
                        (funcall acceptable-p filename)
                      t))
                  nil
                  acceptable-p))
#+end_src

Does that come close?


Michael.





^ permalink raw reply	[relevance 5%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-09-25 21:33  5%     ` Michael Heerdegen
@ 2023-09-26  8:37  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-27  0:26  5%         ` Michael Heerdegen
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-26  8:37 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: philipk, 66187


Michael Heerdegen <michael_heerdegen@web.de> writes:

> AFAIU the algorithm
> works like this: first it's checked whether a completion is allowed (by
> checking whether it's the name of an existing file and consulting
> PREDICATE when specified).  Only when it is not allowed we check whether
> MUSTMATCH declares it acceptable.

Thank you!! That makes sense now.

> This is not really explained in the docstring, however.
>
> In your example, the default-directory is the name of an existing file,
> so the MUSTMATCH argument is irrelevant, the specified PREDICATE is
> fulfilled, so it's accepted as input.
>
> If I guess correctly I think you want something like this:
>
> #+begin_src emacs-lisp
> (let ((acceptable-p (lambda (filename)
>                       (and (file-directory-p filename)
>                            (directory-empty-p filename)))))
>   (read-file-name "Clone into new or empty directory: " nil nil
>                   (lambda (filename)
>                     (if (file-exists-p filename)
>                         (funcall acceptable-p filename)
>                       t))
>                   nil
>                   acceptable-p))
> #+end_src
>
> Does that come close?

Thank you! What I was hoping for may not have a clean solution:

- the completions buffer displays and allows tab-completion for all
  directories, empty or not, then
- upon pressing RET on a non-empty directory, the "[Match required]"
  message appears. Only upon pressing RET on an empty directory does
  completion succeed.

If this cannot be accomplished elegantly, I'll consider other designs
for the interactive prompt in package-vc-checkout.

Thanks!!

Joseph






^ permalink raw reply	[relevance 5%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-09-26  8:37  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-27  0:26  5%         ` Michael Heerdegen
  2023-09-27  0:55 10%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Michael Heerdegen @ 2023-09-27  0:26 UTC (permalink / raw)
  To: Joseph Turner; +Cc: philipk, 66187

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Thank you! What I was hoping for may not have a clean solution:
>
> - the completions buffer displays and allows tab-completion for all
>   directories, empty or not, then
> - upon pressing RET on a non-empty directory, the "[Match required]"
>   message appears. Only upon pressing RET on an empty directory does
>   completion succeed.

Ah - ok, now finally I've understood all the parts.

You want to prompt for a directory that is either empty or not yet
existing.  But with `read-file-name' you only get either (a) non-empty
directories accepted as input, or (b) failing completion of existing
non-empty directories, which makes it impossible to choose a directory
inside an existing directory.

Yes, looks like a bug that this is not possible.  It should be possible
to complete directory names that do not match.

Then the documentation needs to be improved: what exactly is accepted
when both MUSTMATCH and PREDICATE are specified?

Finally, I think the docstring of `read-directory-name' needs to be
updated: it fails to mention that MUSTMATCH can be a function (the
argument is passed directly to `read-file-name').


Michael.





^ permalink raw reply	[relevance 5%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-09-27  0:26  5%         ` Michael Heerdegen
@ 2023-09-27  0:55 10%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-27  1:43  4%             ` Michael Heerdegen
  2023-09-29 12:00  0%             ` Eli Zaretskii
  0 siblings, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-27  0:55 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: philipk, 66187

[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]


Michael Heerdegen <michael_heerdegen@web.de> writes:
> Ah - ok, now finally I've understood all the parts.
>
> You want to prompt for a directory that is either empty or not yet
> existing.  But with `read-file-name' you only get either (a) non-empty
> directories accepted as input, or (b) failing completion of existing
> non-empty directories, which makes it impossible to choose a directory
> inside an existing directory.
>
> Yes, looks like a bug that this is not possible.  It should be possible
> to complete directory names that do not match.

I'm happy to work on the bug, if others agree that this change is desired.

> Then the documentation needs to be improved: what exactly is accepted
> when both MUSTMATCH and PREDICATE are specified?

I can improve the docs too, once I have the answer that questions.

> Finally, I think the docstring of `read-directory-name' needs to be
> updated: it fails to mention that MUSTMATCH can be a function (the
> argument is passed directly to `read-file-name').

How about the attached patch?

> Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-MUSTMATCH-description-in-read-directory-name-doc.patch --]
[-- Type: text/x-diff, Size: 1069 bytes --]

From e0ea8501af4e0dfd9777879e44a07902f86d1a7e Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 26 Sep 2023 18:01:27 -0700
Subject: [PATCH] Fix MUSTMATCH description in read-directory-name docstring

* lisp/files.el (read-directory-name)
---
 lisp/files.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..1fe124848b9 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -817,7 +817,7 @@ non-empty string that was inserted by this function.
 If the user exits with an empty minibuffer, this function returns
 an empty string.  (This can happen only if the user erased the
 pre-inserted contents or if `insert-default-directory' is nil.)
-Fourth arg MUSTMATCH non-nil means require existing directory's name.
+Fourth arg MUSTMATCH is passed as-is to `read-file-name', which see.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-- 
2.41.0


^ permalink raw reply related	[relevance 10%]

* bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
@ 2023-09-27  1:16  8% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-28  9:05  5% ` Philip Kaludercic
  2023-09-29 12:05  0% ` Eli Zaretskii
  0 siblings, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-27  1:16 UTC (permalink / raw)
  To: 66224

[-- Attachment #1: Type: text/plain, Size: 126 bytes --]

Hello!

This patch makes read-directory-name accept an optional PREDICATE arg
so it can be used like read-file-name.

Joseph


[-- Attachment #2: 0001-Add-optional-PREDICATE-argument-to-read-directory-na.patch --]
[-- Type: text/x-diff, Size: 3826 bytes --]

From 78ba02683bd163d8991b182ec4e8ec370e734f95 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 26 Sep 2023 18:14:23 -0700
Subject: [PATCH] Add optional PREDICATE argument to read-directory-name

* lisp/files.el (read-directory-name): Add optional PREDICATE arg.
* doc/lispref/minibuf.texi (Reading File Names): Document change.
* etc/NEWS: Note change.
---
 doc/lispref/minibuf.texi | 6 ++++--
 etc/NEWS                 | 4 ++++
 lisp/files.el            | 8 +++++---
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 620c58ec6e9..c3528ea74d2 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file-name} ignores case
 when performing completion.
 @end defopt
 
-@defun read-directory-name prompt &optional directory default require-match initial
+@defun read-directory-name prompt &optional directory default require-match initial predicate
 This function is like @code{read-file-name} but allows only directory
 names as completion alternatives.
 
@@ -1719,7 +1719,9 @@ combining @var{directory} (or the current buffer's default directory
 if @var{directory} is @code{nil}) and @var{initial}.  If both
 @var{default} and @var{initial} are @code{nil}, this function uses
 @var{directory} as substitute default, or the current buffer's default
-directory if @var{directory} is @code{nil}.
+directory if @var{directory} is @code{nil}.  The union of sixth arg
+@code{predicate} and @code{file-directory-p} is passed as the
+@code{predicate} argument to ‘read-file-name’.
 @end defun
 
 @defopt insert-default-directory
diff --git a/etc/NEWS b/etc/NEWS
index 1b3532b5657..ee0143b1958 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3541,6 +3541,10 @@ This function is called to see whether what the user has typed is a
 match.  This is also available from functions that call
 'completing-read', like 'read-file-name'.
 
+** 'read-directory-name' now accepts an optional PREDICATE argument.
+The union of sixth arg PREDICATE and 'file-directory-p' is passed
+as the PREDICATE argument to 'read-file-name'.
+
 ** 'posn-col-row' can now give position data based on windows.
 Previously, it reported data only based on the frame.
 
diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..e78e8ea0a36 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more details."
     (dos-convert-standard-filename filename))
    (t filename)))
 
-(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
+(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial predicate)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
 Value is not expanded---you must call `expand-file-name' yourself.
 Default name to DEFAULT-DIRNAME if user exits with the same
@@ -821,14 +821,16 @@ Fourth arg MUSTMATCH non-nil means require existing directory's name.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-the value of `default-directory'."
+the value of `default-directory'.
+The union of sixth arg PREDICATE and `file-directory-p' is passed
+as the PREDICATE argument to `read-file-name'."
   (unless dir
     (setq dir default-directory))
   (read-file-name prompt dir (or default-dirname
 				 (if initial (expand-file-name initial dir)
 				   dir))
 		  mustmatch initial
-		  'file-directory-p))
+		  (and #'file-directory-p predicate)))
 
 \f
 (defun pwd (&optional insert)
-- 
2.41.0


^ permalink raw reply related	[relevance 8%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-09-27  0:55 10%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-27  1:43  4%             ` Michael Heerdegen
  2023-10-03 21:18  9%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-29 12:00  0%             ` Eli Zaretskii
  1 sibling, 1 reply; 200+ results
From: Michael Heerdegen @ 2023-09-27  1:43 UTC (permalink / raw)
  To: Joseph Turner; +Cc: philipk, 66187

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> > Yes, looks like a bug that this is not possible.  It should be possible
> > to complete directory names that do not match.
>
> I'm happy to work on the bug, if others agree that this change is
> desired.

I had a look and tried this:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-WIP-Bug-66187.patch --]
[-- Type: text/x-diff, Size: 2765 bytes --]

From ad895d2df5c69e015c2c7eba5116ab2d440e1fbc Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
Date: Wed, 27 Sep 2023 03:32:37 +0200
Subject: [PATCH] WIP: Bug#66187

---
 lisp/minibuffer.el | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 2120e31775e..79a8786fbac 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -3061,13 +3061,23 @@ completion-file-name-table
           (funcall (or pred 'file-exists-p) string)))

        (t
-        (let* ((name (file-name-nondirectory string))
+        (let* ((test-directory (lambda (s)
+                                 (let ((len (length s)))
+                                   (and (> len 0) (eq (aref s (1- len)) ?/)))))
+               (should-complete
+                (and pred
+                     (if (eq pred 'file-directory-p)
+                         test-directory
+                       (lambda (f)
+                         (or (funcall test-directory f)
+                             (funcall pred f))))))
+               (name (file-name-nondirectory string))
                (specdir (file-name-directory string))
                (realdir (or specdir default-directory)))

           (cond
            ((null action)
-            (let ((comp (file-name-completion name realdir pred)))
+            (let ((comp (file-name-completion name realdir should-complete)))
               (if (stringp comp)
                   (concat specdir comp)
                 comp)))
@@ -3078,18 +3088,9 @@ completion-file-name-table
               ;; Check the predicate, if necessary.
               (unless (memq pred '(nil file-exists-p))
                 (let ((comp ())
-                      (pred
-                       (if (eq pred 'file-directory-p)
-                           ;; Brute-force speed up for directory checking:
-                           ;; Discard strings which don't end in a slash.
-                           (lambda (s)
-                             (let ((len (length s)))
-                               (and (> len 0) (eq (aref s (1- len)) ?/))))
-                         ;; Must do it the hard (and slow) way.
-                         pred)))
-                  (let ((default-directory (expand-file-name realdir)))
-                    (dolist (tem all)
-                      (if (funcall pred tem) (push tem comp))))
+                      (default-directory (expand-file-name realdir)))
+                  (dolist (tem all)
+                    (if (funcall should-complete tem) (push tem comp)))
                   (setq all (nreverse comp))))

               all))))))
--
2.39.2


[-- Attachment #3: Type: text/plain, Size: 1179 bytes --]


I thought this would make Emacs complete as you want.  But: what files
should be shown when hitting TAB?  I decided to show only matching
files, plus all directories (seems logical, since these may contain
matching files).

But that gives a bad user experience: When I tried this I thought it
would not work because completion did not accept an existing empty
directory.  Then I saw that it actually was not empty.  But it contained only
plain files, no subdirectories, and TAB displayed nothing.  Quite confusing!


> How about the attached patch?

| diff --git a/lisp/files.el b/lisp/files.el
| index b72f141c0ee..1fe124848b9 100644
| --- a/lisp/files.el
| +++ b/lisp/files.el
| @@ -817,7 +817,7 @@ non-empty string that was inserted by this function.
|  If the user exits with an empty minibuffer, this function returns
|  an empty string.  (This can happen only if the user erased the
|  pre-inserted contents or if `insert-default-directory' is nil.)
| -Fourth arg MUSTMATCH non-nil means require existing directory's name.
| +Fourth arg MUSTMATCH is passed as-is to `read-file-name', which see.

Ok from my side.

What do others think about all of this?


Thx,

Michael.


^ permalink raw reply related	[relevance 4%]

* bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
  2023-09-27  1:16  8% bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-28  9:05  5% ` Philip Kaludercic
  2023-09-29  3:28  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-29  3:28  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-29 12:05  0% ` Eli Zaretskii
  1 sibling, 2 replies; 200+ results
From: Philip Kaludercic @ 2023-09-28  9:05 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 66224

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Hello!
>
> This patch makes read-directory-name accept an optional PREDICATE arg
> so it can be used like read-file-name.
>
> Joseph
>
>>From 78ba02683bd163d8991b182ec4e8ec370e734f95 Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Tue, 26 Sep 2023 18:14:23 -0700
> Subject: [PATCH] Add optional PREDICATE argument to read-directory-name
>
> * lisp/files.el (read-directory-name): Add optional PREDICATE arg.
> * doc/lispref/minibuf.texi (Reading File Names): Document change.
> * etc/NEWS: Note change.
> ---
>  doc/lispref/minibuf.texi | 6 ++++--
>  etc/NEWS                 | 4 ++++
>  lisp/files.el            | 8 +++++---
>  3 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
> index 620c58ec6e9..c3528ea74d2 100644
> --- a/doc/lispref/minibuf.texi
> +++ b/doc/lispref/minibuf.texi
> @@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file-name} ignores case
>  when performing completion.
>  @end defopt
>  
> -@defun read-directory-name prompt &optional directory default require-match initial
> +@defun read-directory-name prompt &optional directory default require-match initial predicate
>  This function is like @code{read-file-name} but allows only directory
>  names as completion alternatives.
>  
> @@ -1719,7 +1719,9 @@ combining @var{directory} (or the current buffer's default directory
>  if @var{directory} is @code{nil}) and @var{initial}.  If both
>  @var{default} and @var{initial} are @code{nil}, this function uses
>  @var{directory} as substitute default, or the current buffer's default
> -directory if @var{directory} is @code{nil}.
> +directory if @var{directory} is @code{nil}.  The union of sixth arg
> +@code{predicate} and @code{file-directory-p} is passed as the
> +@code{predicate} argument to ‘read-file-name’.
>  @end defun
>  
>  @defopt insert-default-directory
> diff --git a/etc/NEWS b/etc/NEWS
> index 1b3532b5657..ee0143b1958 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -3541,6 +3541,10 @@ This function is called to see whether what the user has typed is a
>  match.  This is also available from functions that call
>  'completing-read', like 'read-file-name'.
>  
> +** 'read-directory-name' now accepts an optional PREDICATE argument.
> +The union of sixth arg PREDICATE and 'file-directory-p' is passed
> +as the PREDICATE argument to 'read-file-name'.
> +
>  ** 'posn-col-row' can now give position data based on windows.
>  Previously, it reported data only based on the frame.
>  
> diff --git a/lisp/files.el b/lisp/files.el
> index b72f141c0ee..e78e8ea0a36 100644
> --- a/lisp/files.el
> +++ b/lisp/files.el
> @@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more details."
>      (dos-convert-standard-filename filename))
>     (t filename)))
>  
> -(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
> +(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial predicate)
>    "Read directory name, prompting with PROMPT and completing in directory DIR.
>  Value is not expanded---you must call `expand-file-name' yourself.
>  Default name to DEFAULT-DIRNAME if user exits with the same
> @@ -821,14 +821,16 @@ Fourth arg MUSTMATCH non-nil means require existing directory's name.
>   Non-nil and non-t means also require confirmation after completion.
>  Fifth arg INITIAL specifies text to start with.
>  DIR should be an absolute directory name.  It defaults to
> -the value of `default-directory'."
> +the value of `default-directory'.
> +The union of sixth arg PREDICATE and `file-directory-p' is passed
> +as the PREDICATE argument to `read-file-name'."
>    (unless dir
>      (setq dir default-directory))
>    (read-file-name prompt dir (or default-dirname
>  				 (if initial (expand-file-name initial dir)
>  				   dir))
>  		  mustmatch initial
> -		  'file-directory-p))
> +		  (and #'file-directory-p predicate)))

I am not sure this makes sense, #'file-directory-p is always non-nil but
a PREDICATE will only be passed on to `read-file-name' is PREDICATE is
also non-nil.  So if no PREDICATE is passed, the expression ignored
#'file-directory-p, breaking `read-directory-name', or am I mistaken (I
haven't tried it out)?

>  
>  \f
>  (defun pwd (&optional insert)





^ permalink raw reply	[relevance 5%]

* bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
  2023-09-28  9:05  5% ` Philip Kaludercic
@ 2023-09-29  3:28  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-29  3:54  5%     ` Michael Heerdegen
  2023-09-29  3:28  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-29  3:28 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 66224

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]


Philip Kaludercic <philipk@posteo.net> writes:
>
> I am not sure this makes sense, #'file-directory-p is always non-nil but
> a PREDICATE will only be passed on to `read-file-name' is PREDICATE is
> also non-nil.  So if no PREDICATE is passed, the expression ignored
> #'file-directory-p, breaking `read-directory-name', or am I mistaken (I
> haven't tried it out)?

Oops! Thanks for catching my error!! The attached patch should actually
do what I intended.

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-optional-PREDICATE-argument-to-read-directory-na.patch --]
[-- Type: text/x-diff, Size: 4119 bytes --]

From 58f4215a6742c6cefc318f84544cc74495c901c1 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Thu, 28 Sep 2023 20:27:47 -0700
Subject: [PATCH] Add optional PREDICATE argument to read-directory-name

* lisp/files.el (read-directory-name): Add optional PREDICATE arg.
* doc/lispref/minibuf.texi (Reading File Names): Document change.
* etc/NEWS: Note change.
---
 doc/lispref/minibuf.texi |  7 +++++--
 etc/NEWS                 |  5 +++++
 lisp/files.el            | 13 ++++++++++---
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 620c58ec6e9..bf4d6e13d3a 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file-name} ignores case
 when performing completion.
 @end defopt
 
-@defun read-directory-name prompt &optional directory default require-match initial
+@defun read-directory-name prompt &optional directory default require-match initial predicate
 This function is like @code{read-file-name} but allows only directory
 names as completion alternatives.
 
@@ -1719,7 +1719,10 @@ combining @var{directory} (or the current buffer's default directory
 if @var{directory} is @code{nil}) and @var{initial}.  If both
 @var{default} and @var{initial} are @code{nil}, this function uses
 @var{directory} as substitute default, or the current buffer's default
-directory if @var{directory} is @code{nil}.
+directory if @var{directory} is @code{nil}.  When optional sixth
+argument @code{predicate} is non-nil, the union of @code{predicate}
+and @code{file-directory-p} is passed as the @code{predicate} argument
+to @code{read-file-name}.
 @end defun
 
 @defopt insert-default-directory
diff --git a/etc/NEWS b/etc/NEWS
index 1b3532b5657..fb9f6a0b43f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3541,6 +3541,11 @@ This function is called to see whether what the user has typed is a
 match.  This is also available from functions that call
 'completing-read', like 'read-file-name'.
 
+** 'read-directory-name' now accepts an optional PREDICATE argument.
+When optional sixth argument PREDICATE is non-nil, the union of
+PREDICATE and 'file-directory-p' is passed as the PREDICATE argument
+to 'read-file-name'.
+
 ** 'posn-col-row' can now give position data based on windows.
 Previously, it reported data only based on the frame.
 
diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..17f433fd339 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more details."
     (dos-convert-standard-filename filename))
    (t filename)))
 
-(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
+(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial predicate)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
 Value is not expanded---you must call `expand-file-name' yourself.
 Default name to DEFAULT-DIRNAME if user exits with the same
@@ -821,14 +821,21 @@ Fourth arg MUSTMATCH non-nil means require existing directory's name.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-the value of `default-directory'."
+the value of `default-directory'.
+When sixth arg PREDICATE is non-nil, the union of PREDICATE and
+`file-directory-p' is passed as the PREDICATE argument to
+`read-file-name'. Otherwise, only `file-directory-p' is passed."
   (unless dir
     (setq dir default-directory))
   (read-file-name prompt dir (or default-dirname
 				 (if initial (expand-file-name initial dir)
 				   dir))
 		  mustmatch initial
-		  'file-directory-p))
+                  (lambda (filename)
+                    (if predicate
+                        (and (file-directory-p filename)
+                             (funcall predicate filename))
+                      (file-directory-p filename)))))
 
 \f
 (defun pwd (&optional insert)
-- 
2.41.0


^ permalink raw reply related	[relevance 8%]

* bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
  2023-09-28  9:05  5% ` Philip Kaludercic
  2023-09-29  3:28  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-29  3:28  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-29  3:28 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: 66224

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]


Philip Kaludercic <philipk@posteo.net> writes:
>
> I am not sure this makes sense, #'file-directory-p is always non-nil but
> a PREDICATE will only be passed on to `read-file-name' is PREDICATE is
> also non-nil.  So if no PREDICATE is passed, the expression ignored
> #'file-directory-p, breaking `read-directory-name', or am I mistaken (I
> haven't tried it out)?

Oops! Thanks for catching my error!! The attached patch should actually
do what I intended.

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-optional-PREDICATE-argument-to-read-directory-na.patch --]
[-- Type: text/x-diff, Size: 4119 bytes --]

From 58f4215a6742c6cefc318f84544cc74495c901c1 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Thu, 28 Sep 2023 20:27:47 -0700
Subject: [PATCH] Add optional PREDICATE argument to read-directory-name

* lisp/files.el (read-directory-name): Add optional PREDICATE arg.
* doc/lispref/minibuf.texi (Reading File Names): Document change.
* etc/NEWS: Note change.
---
 doc/lispref/minibuf.texi |  7 +++++--
 etc/NEWS                 |  5 +++++
 lisp/files.el            | 13 ++++++++++---
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 620c58ec6e9..bf4d6e13d3a 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file-name} ignores case
 when performing completion.
 @end defopt
 
-@defun read-directory-name prompt &optional directory default require-match initial
+@defun read-directory-name prompt &optional directory default require-match initial predicate
 This function is like @code{read-file-name} but allows only directory
 names as completion alternatives.
 
@@ -1719,7 +1719,10 @@ combining @var{directory} (or the current buffer's default directory
 if @var{directory} is @code{nil}) and @var{initial}.  If both
 @var{default} and @var{initial} are @code{nil}, this function uses
 @var{directory} as substitute default, or the current buffer's default
-directory if @var{directory} is @code{nil}.
+directory if @var{directory} is @code{nil}.  When optional sixth
+argument @code{predicate} is non-nil, the union of @code{predicate}
+and @code{file-directory-p} is passed as the @code{predicate} argument
+to @code{read-file-name}.
 @end defun
 
 @defopt insert-default-directory
diff --git a/etc/NEWS b/etc/NEWS
index 1b3532b5657..fb9f6a0b43f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3541,6 +3541,11 @@ This function is called to see whether what the user has typed is a
 match.  This is also available from functions that call
 'completing-read', like 'read-file-name'.
 
+** 'read-directory-name' now accepts an optional PREDICATE argument.
+When optional sixth argument PREDICATE is non-nil, the union of
+PREDICATE and 'file-directory-p' is passed as the PREDICATE argument
+to 'read-file-name'.
+
 ** 'posn-col-row' can now give position data based on windows.
 Previously, it reported data only based on the frame.
 
diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..17f433fd339 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more details."
     (dos-convert-standard-filename filename))
    (t filename)))
 
-(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
+(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial predicate)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
 Value is not expanded---you must call `expand-file-name' yourself.
 Default name to DEFAULT-DIRNAME if user exits with the same
@@ -821,14 +821,21 @@ Fourth arg MUSTMATCH non-nil means require existing directory's name.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-the value of `default-directory'."
+the value of `default-directory'.
+When sixth arg PREDICATE is non-nil, the union of PREDICATE and
+`file-directory-p' is passed as the PREDICATE argument to
+`read-file-name'. Otherwise, only `file-directory-p' is passed."
   (unless dir
     (setq dir default-directory))
   (read-file-name prompt dir (or default-dirname
 				 (if initial (expand-file-name initial dir)
 				   dir))
 		  mustmatch initial
-		  'file-directory-p))
+                  (lambda (filename)
+                    (if predicate
+                        (and (file-directory-p filename)
+                             (funcall predicate filename))
+                      (file-directory-p filename)))))
 
 \f
 (defun pwd (&optional insert)
-- 
2.41.0


^ permalink raw reply related	[relevance 8%]

* bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
  2023-09-29  3:28  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-29  3:54  5%     ` Michael Heerdegen
  2023-09-29  4:19  8%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Michael Heerdegen @ 2023-09-29  3:54 UTC (permalink / raw)
  To: 66224; +Cc: philipk, joseph

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> -		  'file-directory-p))
> +                  (lambda (filename)
> +                    (if predicate
> +                        (and (file-directory-p filename)
> +                             (funcall predicate filename))
> +                      (file-directory-p filename)))))

Yip.  Nitpick: The code will be faster if you move the test out of the
predicate (so that it will not be performed repeatedly):

#+begin_src emacs-lisp
(if predicate
    (lambda (filename)
      (and (file-directory-p filename)
           (funcall predicate filename)))
  #'file-directory-p)
#+end_src


Michael.






^ permalink raw reply	[relevance 5%]

* bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
  2023-09-29  3:54  5%     ` Michael Heerdegen
@ 2023-09-29  4:19  8%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-03  3:30  5%         ` Michael Heerdegen
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-29  4:19 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 66224, philipk

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]


Michael Heerdegen <michael_heerdegen@web.de> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
>
>> -		  'file-directory-p))
>> +                  (lambda (filename)
>> +                    (if predicate
>> +                        (and (file-directory-p filename)
>> +                             (funcall predicate filename))
>> +                      (file-directory-p filename)))))
>
> Yip.  Nitpick: The code will be faster if you move the test out of the
> predicate (so that it will not be performed repeatedly):
>
> #+begin_src emacs-lisp
> (if predicate
>     (lambda (filename)
>       (and (file-directory-p filename)
>            (funcall predicate filename)))
>   #'file-directory-p)
> #+end_src

Thank you!! See attached patch.

Joseph

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-optional-PREDICATE-argument-to-read-directory-na.patch --]
[-- Type: text/x-diff, Size: 4110 bytes --]

From 894e44bce60cf30c9e8bc8c5323eaed91d135bbb Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Thu, 28 Sep 2023 20:27:47 -0700
Subject: [PATCH] Add optional PREDICATE argument to read-directory-name

* lisp/files.el (read-directory-name): Add optional PREDICATE arg.
* doc/lispref/minibuf.texi (Reading File Names): Document change.
* etc/NEWS: Note change.
---
 doc/lispref/minibuf.texi |  7 +++++--
 etc/NEWS                 |  5 +++++
 lisp/files.el            | 13 ++++++++++---
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 620c58ec6e9..bf4d6e13d3a 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file-name} ignores case
 when performing completion.
 @end defopt
 
-@defun read-directory-name prompt &optional directory default require-match initial
+@defun read-directory-name prompt &optional directory default require-match initial predicate
 This function is like @code{read-file-name} but allows only directory
 names as completion alternatives.
 
@@ -1719,7 +1719,10 @@ combining @var{directory} (or the current buffer's default directory
 if @var{directory} is @code{nil}) and @var{initial}.  If both
 @var{default} and @var{initial} are @code{nil}, this function uses
 @var{directory} as substitute default, or the current buffer's default
-directory if @var{directory} is @code{nil}.
+directory if @var{directory} is @code{nil}.  When optional sixth
+argument @code{predicate} is non-nil, the union of @code{predicate}
+and @code{file-directory-p} is passed as the @code{predicate} argument
+to @code{read-file-name}.
 @end defun
 
 @defopt insert-default-directory
diff --git a/etc/NEWS b/etc/NEWS
index 1b3532b5657..fb9f6a0b43f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3541,6 +3541,11 @@ This function is called to see whether what the user has typed is a
 match.  This is also available from functions that call
 'completing-read', like 'read-file-name'.
 
+** 'read-directory-name' now accepts an optional PREDICATE argument.
+When optional sixth argument PREDICATE is non-nil, the union of
+PREDICATE and 'file-directory-p' is passed as the PREDICATE argument
+to 'read-file-name'.
+
 ** 'posn-col-row' can now give position data based on windows.
 Previously, it reported data only based on the frame.
 
diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..68855cd1c6d 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more details."
     (dos-convert-standard-filename filename))
    (t filename)))
 
-(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
+(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial predicate)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
 Value is not expanded---you must call `expand-file-name' yourself.
 Default name to DEFAULT-DIRNAME if user exits with the same
@@ -821,14 +821,21 @@ Fourth arg MUSTMATCH non-nil means require existing directory's name.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-the value of `default-directory'."
+the value of `default-directory'.
+When sixth arg PREDICATE is non-nil, the union of PREDICATE and
+`file-directory-p' is passed as the PREDICATE argument to
+`read-file-name'. Otherwise, only `file-directory-p' is passed."
   (unless dir
     (setq dir default-directory))
   (read-file-name prompt dir (or default-dirname
 				 (if initial (expand-file-name initial dir)
 				   dir))
 		  mustmatch initial
-		  'file-directory-p))
+                  (if predicate
+                      (lambda (filename)
+                        (and (file-directory-p filename)
+                             (funcall predicate filename)))
+                    #'file-directory-p)))
 
 \f
 (defun pwd (&optional insert)
-- 
2.41.0


^ permalink raw reply related	[relevance 8%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-09-27  0:55 10%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-27  1:43  4%             ` Michael Heerdegen
@ 2023-09-29 12:00  0%             ` Eli Zaretskii
  2023-10-03 20:43  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-09-29 12:00 UTC (permalink / raw)
  To: Joseph Turner; +Cc: michael_heerdegen, philipk, 66187

> Cc: philipk@posteo.net, 66187@debbugs.gnu.org
> Date: Tue, 26 Sep 2023 17:55:37 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> > Finally, I think the docstring of `read-directory-name' needs to be
> > updated: it fails to mention that MUSTMATCH can be a function (the
> > argument is passed directly to `read-file-name').
> 
> How about the attached patch?

This is okay, except that we do document the other arguments.  So why
not just copy/paste the description of MUSTMATCH from read-file-name
to read-directory-name instead?





^ permalink raw reply	[relevance 0%]

* bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
  2023-09-27  1:16  8% bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-28  9:05  5% ` Philip Kaludercic
@ 2023-09-29 12:05  0% ` Eli Zaretskii
  2023-10-03 23:08  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-09-29 12:05 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 66224

> Date: Tue, 26 Sep 2023 18:16:40 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> This patch makes read-directory-name accept an optional PREDICATE arg
> so it can be used like read-file-name.

Any rationale?

> @@ -1719,7 +1719,9 @@ combining @var{directory} (or the current buffer's default directory
>  if @var{directory} is @code{nil}) and @var{initial}.  If both
>  @var{default} and @var{initial} are @code{nil}, this function uses
>  @var{directory} as substitute default, or the current buffer's default
> -directory if @var{directory} is @code{nil}.
> +directory if @var{directory} is @code{nil}.  The union of sixth arg
> +@code{predicate} and @code{file-directory-p} is passed as the

This should be elaborated: what is meant by "the union of sixth arg
and 'file-directory-p'"?

> +@code{predicate} argument to ‘read-file-name’.
                                ^^^^^^^^^^^^^^^^
That should be @code{read-file-name}

> +** 'read-directory-name' now accepts an optional PREDICATE argument.
> +The union of sixth arg PREDICATE and 'file-directory-p' is passed
> +as the PREDICATE argument to 'read-file-name'.

Likewise here, regarding the "union" part.

Also, since you submit the patch for the manual, this NEWS entry
should be marked with "+++".

>  Fifth arg INITIAL specifies text to start with.
>  DIR should be an absolute directory name.  It defaults to
> -the value of `default-directory'."
> +the value of `default-directory'.
> +The union of sixth arg PREDICATE and `file-directory-p' is passed
> +as the PREDICATE argument to `read-file-name'."

The "union" part again.

Thanks.





^ permalink raw reply	[relevance 0%]

* bug#65768: Bump persist.el version
  2023-09-16 22:28  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-30 14:30 11%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-30 14:30 UTC (permalink / raw)
  To: Stefan Kangas, 65768, Phillip Lord

Ping :)

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Ping.






^ permalink raw reply	[relevance 11%]

* bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
  2023-09-29  4:19  8%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-03  3:30  5%         ` Michael Heerdegen
  2023-10-03 23:20  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Michael Heerdegen @ 2023-10-03  3:30 UTC (permalink / raw)
  To: 66224; +Cc: philipk, joseph

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> Thank you!! See attached patch.

Yes, thanks, the code LGTM now.

You know that the predicate will be ignored when MUSTMATCH is t?
The behavior is not different than for `read-file-name'.

I think your patch is definitely a step in the right direction, but I
also still think we should think about the semantics of the restricting
arguments as a whole.

Michael.





^ permalink raw reply	[relevance 5%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-09-29 12:00  0%             ` Eli Zaretskii
@ 2023-10-03 20:43  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-04  6:05  0%                 ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-03 20:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael_heerdegen, philipk, 66187


Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: philipk@posteo.net, 66187@debbugs.gnu.org
>> Date: Tue, 26 Sep 2023 17:55:37 -0700
>> From:  Joseph Turner via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>> > Finally, I think the docstring of `read-directory-name' needs to be
>> > updated: it fails to mention that MUSTMATCH can be a function (the
>> > argument is passed directly to `read-file-name').
>>
>> How about the attached patch?
>
> This is okay, except that we do document the other arguments.  So why
> not just copy/paste the description of MUSTMATCH from read-file-name
> to read-directory-name instead?

The read-file-name docstring for MUSTMATCH is lengthy, and duplicating
it will mean that if read-file-name changes, we'll need to remember to
change the docstring of read-directory-name.





^ permalink raw reply	[relevance 5%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-09-27  1:43  4%             ` Michael Heerdegen
@ 2023-10-03 21:18  9%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-04  3:35  5%                 ` Michael Heerdegen
  2023-10-04  7:03  0%                 ` Eli Zaretskii
  0 siblings, 2 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-03 21:18 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: philipk, 66187

[-- Attachment #1: Type: text/plain, Size: 4573 bytes --]


Michael Heerdegen <michael_heerdegen@web.de> writes:

> I had a look and tried this:
>
> [2. text/x-diff; 0001-WIP-Bug-66187.patch]
> From ad895d2df5c69e015c2c7eba5116ab2d440e1fbc Mon Sep 17 00:00:00 2001
> From: Michael Heerdegen <michael_heerdegen@web.de>
> Date: Wed, 27 Sep 2023 03:32:37 +0200
> Subject: [PATCH] WIP: Bug#66187
>
> ---
>  lisp/minibuffer.el | 29 +++++++++++++++--------------
>  1 file changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
> index 2120e31775e..79a8786fbac 100644
> --- a/lisp/minibuffer.el
> +++ b/lisp/minibuffer.el
> @@ -3061,13 +3061,23 @@ completion-file-name-table
>            (funcall (or pred 'file-exists-p) string)))
>
>         (t
> -        (let* ((name (file-name-nondirectory string))
> +        (let* ((test-directory (lambda (s)
> +                                 (let ((len (length s)))
> +                                   (and (> len 0) (eq (aref s (1- len)) ?/)))))
> +               (should-complete
> +                (and pred
> +                     (if (eq pred 'file-directory-p)
> +                         test-directory
> +                       (lambda (f)
> +                         (or (funcall test-directory f)
> +                             (funcall pred f))))))
> +               (name (file-name-nondirectory string))
>                 (specdir (file-name-directory string))
>                 (realdir (or specdir default-directory)))
>
>            (cond
>             ((null action)
> -            (let ((comp (file-name-completion name realdir pred)))
> +            (let ((comp (file-name-completion name realdir should-complete)))
>                (if (stringp comp)
>                    (concat specdir comp)
>                  comp)))
> @@ -3078,18 +3088,9 @@ completion-file-name-table
>                ;; Check the predicate, if necessary.
>                (unless (memq pred '(nil file-exists-p))
>                  (let ((comp ())
> -                      (pred
> -                       (if (eq pred 'file-directory-p)
> -                           ;; Brute-force speed up for directory checking:
> -                           ;; Discard strings which don't end in a slash.
> -                           (lambda (s)
> -                             (let ((len (length s)))
> -                               (and (> len 0) (eq (aref s (1- len)) ?/))))
> -                         ;; Must do it the hard (and slow) way.
> -                         pred)))
> -                  (let ((default-directory (expand-file-name realdir)))
> -                    (dolist (tem all)
> -                      (if (funcall pred tem) (push tem comp))))
> +                      (default-directory (expand-file-name realdir)))
> +                  (dolist (tem all)
> +                    (if (funcall should-complete tem) (push tem comp)))
>                    (setq all (nreverse comp))))
>
>                all))))))

> I thought this would make Emacs complete as you want.  But: what files
> should be shown when hitting TAB?  I decided to show only matching
> files, plus all directories (seems logical, since these may contain
> matching files).

> But that gives a bad user experience: When I tried this I thought it
> would not work because completion did not accept an existing empty
> directory.  Then I saw that it actually was not empty.  But it contained only
> plain files, no subdirectories, and TAB displayed nothing.  Quite confusing!

I dug a little more and realized that the IMO unexpected behavior
resides in completing-read itself.  According to the completing-read
docstring, its REQUIRE-MATCH argument can be

- a function, which will be called with the input as the
  argument.  If the function returns a non-nil value, the
  minibuffer is exited with that argument as the value.

I incorrectly assumed that this function would prevent matching items
inside COLLECTION for which the function returns nil.  What it actually
does it accept input which is not part of COLLECTION if the
REQUIRE-MATCH function returns non-nil.  IOW, it doesn't narrow the
potential completion options; it widens them.

For example, given:

(completing-read "Prompt: " '("a" "b") nil
                 (lambda (input)
                   (string= "a" input)))

I expected that the prompt would refuse to complete "b". I was wrong.

Since completing-read is such a fundamental part of Emacs, I doubt it
will be possible to change this behavior.  What do you think about the
attached patch to clarify the completing-read docstring?

Thank you!!

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Clarify-completing-read-REQUIRE-MATCH-function-docst.patch --]
[-- Type: text/x-diff, Size: 1316 bytes --]

From 10fa6dd5c659bed2b818fb925445cab2cbbb5325 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 3 Oct 2023 14:40:22 -0700
Subject: [PATCH] Clarify completing-read REQUIRE-MATCH function docstring

* src/minibuf.c (Fcompleting_read): Explicitly note that REQUIRE-MATCH
function does not narrow the completion candidates.
---
 src/minibuf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/minibuf.c b/src/minibuf.c
index 58adde1bf66..616be7091ee 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1999,8 +1999,11 @@ REQUIRE-MATCH can take the following values:
   `minibuffer-complete' right before `minibuffer-complete-and-exit'
   and the input is not an element of COLLECTION.
 - a function, which will be called with the input as the
-  argument.  If the function returns a non-nil value, the
-  minibuffer is exited with that argument as the value.
+  argument.  If the function returns a non-nil value or if
+  the input is a member of COLLECTION, the minibuffer is
+  exited with that argument as the value.  If the function
+  returns nil and the input is not a member of COLLECTION,
+  then the user is not allowed to exit.
 - anything else behaves like t except that typing RET does not exit if it
   does non-null completion.
 
-- 
2.41.0


^ permalink raw reply related	[relevance 9%]

* bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
  2023-09-29 12:05  0% ` Eli Zaretskii
@ 2023-10-03 23:08  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-03 23:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 66224

[-- Attachment #1: Type: text/plain, Size: 2440 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Tue, 26 Sep 2023 18:16:40 -0700
>> From:  Joseph Turner via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>> This patch makes read-directory-name accept an optional PREDICATE arg
>> so it can be used like read-file-name.
>
> Any rationale?

Mainly code clarity. If you want to prompt for a certain type of
directory, then IMO the intent is more clear like this:

(read-directory-name "Prompt: " "~/" nil nil nil #'my/predicate)

than like this:

(read-file-name "Prompt: " "~/" nil nil nil
                (lambda (filename)
                  (and (funcall #'file-directory-p filename)
                       (funcall #'my/predicate filename))))

Also, I think that it would follow the principle of least suprise to
have read-file-name and read-directory-name accept the same args.

>> @@ -1719,7 +1719,9 @@ combining @var{directory} (or the current buffer's default directory
>>  if @var{directory} is @code{nil}) and @var{initial}.  If both
>>  @var{default} and @var{initial} are @code{nil}, this function uses
>>  @var{directory} as substitute default, or the current buffer's default
>> -directory if @var{directory} is @code{nil}.
>> +directory if @var{directory} is @code{nil}.  The union of sixth arg
>> +@code{predicate} and @code{file-directory-p} is passed as the
>
> This should be elaborated: what is meant by "the union of sixth arg
> and 'file-directory-p'"?
>
>> +@code{predicate} argument to ‘read-file-name’.
>                                 ^^^^^^^^^^^^^^^^
> That should be @code{read-file-name}
>
>> +** 'read-directory-name' now accepts an optional PREDICATE argument.
>> +The union of sixth arg PREDICATE and 'file-directory-p' is passed
>> +as the PREDICATE argument to 'read-file-name'.
>
> Likewise here, regarding the "union" part.
>
> Also, since you submit the patch for the manual, this NEWS entry
> should be marked with "+++".
>
>>  Fifth arg INITIAL specifies text to start with.
>>  DIR should be an absolute directory name.  It defaults to
>> -the value of `default-directory'."
>> +the value of `default-directory'.
>> +The union of sixth arg PREDICATE and `file-directory-p' is passed
>> +as the PREDICATE argument to `read-file-name'."
>
> The "union" part again.

Thanks for the review!! Please see attached patch.

Best,

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-optional-PREDICATE-argument-to-read-directory-na.patch --]
[-- Type: text/x-diff, Size: 4288 bytes --]

From 1c7581914c1b446ea17692d425a4605d915fa7ef Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Thu, 28 Sep 2023 20:27:47 -0700
Subject: [PATCH] Add optional PREDICATE argument to read-directory-name

* lisp/files.el (read-directory-name): Add optional PREDICATE arg.
* doc/lispref/minibuf.texi (Reading File Names): Document change.
* etc/NEWS: Note change.
---
 doc/lispref/minibuf.texi |  8 ++++++--
 etc/NEWS                 |  7 +++++++
 lisp/files.el            | 14 +++++++++++---
 3 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 620c58ec6e9..eb344595ae3 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1709,7 +1709,7 @@ If this variable is non-@code{nil}, @code{read-file-name} ignores case
 when performing completion.
 @end defopt
 
-@defun read-directory-name prompt &optional directory default require-match initial
+@defun read-directory-name prompt &optional directory default require-match initial predicate
 This function is like @code{read-file-name} but allows only directory
 names as completion alternatives.
 
@@ -1719,7 +1719,11 @@ combining @var{directory} (or the current buffer's default directory
 if @var{directory} is @code{nil}) and @var{initial}.  If both
 @var{default} and @var{initial} are @code{nil}, this function uses
 @var{directory} as substitute default, or the current buffer's default
-directory if @var{directory} is @code{nil}.
+directory if @var{directory} is @code{nil}.  Sixth arg
+@code{predicate}, if non-nil, should be a function of one argument;
+then a file name is considered an acceptable completion alternative if
+both @code{file-directory-p} and @code{predicate} return non-nil with
+the file name argument.
 @end defun
 
 @defopt insert-default-directory
diff --git a/etc/NEWS b/etc/NEWS
index 1b3532b5657..a5a41d6546f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3541,6 +3541,13 @@ This function is called to see whether what the user has typed is a
 match.  This is also available from functions that call
 'completing-read', like 'read-file-name'.
 
++++
+** 'read-directory-name' now accepts an optional PREDICATE argument.
+Sixth arg PREDICATE, if non-nil, should be a function of one argument;
+then a file name is considered an acceptable completion alternative if
+both `file-directory-p' and PREDICATE return non-nil with the file
+name argument.
+
 ** 'posn-col-row' can now give position data based on windows.
 Previously, it reported data only based on the frame.
 
diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..1663f1e2d71 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -807,7 +807,7 @@ See Info node `(elisp)Standard File Names' for more details."
     (dos-convert-standard-filename filename))
    (t filename)))
 
-(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
+(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial predicate)
   "Read directory name, prompting with PROMPT and completing in directory DIR.
 Value is not expanded---you must call `expand-file-name' yourself.
 Default name to DEFAULT-DIRNAME if user exits with the same
@@ -821,14 +821,22 @@ Fourth arg MUSTMATCH non-nil means require existing directory's name.
  Non-nil and non-t means also require confirmation after completion.
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
-the value of `default-directory'."
+the value of `default-directory'.
+Sixth arg PREDICATE, if non-nil, should be a function of one
+argument; then a file name is considered an acceptable completion
+alternative if both `file-directory-p' and PREDICATE return
+non-nil with the file name argument."
   (unless dir
     (setq dir default-directory))
   (read-file-name prompt dir (or default-dirname
 				 (if initial (expand-file-name initial dir)
 				   dir))
 		  mustmatch initial
-		  'file-directory-p))
+                  (if predicate
+                      (lambda (filename)
+                        (and (file-directory-p filename)
+                             (funcall predicate filename)))
+                    #'file-directory-p)))
 
 \f
 (defun pwd (&optional insert)
-- 
2.41.0


^ permalink raw reply related	[relevance 8%]

* bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
  2023-10-03  3:30  5%         ` Michael Heerdegen
@ 2023-10-03 23:20  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-05  1:23  5%             ` Michael Heerdegen
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-03 23:20 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 66224, philipk


Michael Heerdegen <michael_heerdegen@web.de> writes:

> You know that the predicate will be ignored when MUSTMATCH is t?
> The behavior is not different than for `read-file-name'.

I'm not sure what you mean. In both of the following examples, PREDICATE
is used to narrow the completion candidates to only empty directories:

(read-directory-name "Prompt: " "~/" nil t nil #'directory-empty-p)
(read-directory-name "Prompt: " "~/" nil nil nil #'directory-empty-p)

Thank you!

Joseph





^ permalink raw reply	[relevance 5%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-10-03 21:18  9%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-04  3:35  5%                 ` Michael Heerdegen
  2023-10-04  5:22  5%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-04  7:03  0%                 ` Eli Zaretskii
  1 sibling, 1 reply; 200+ results
From: Michael Heerdegen @ 2023-10-04  3:35 UTC (permalink / raw)
  To: 66187; +Cc: philipk, joseph

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> Since completing-read is such a fundamental part of Emacs, I doubt it
> will be possible to change this behavior.

This is only about `read-file-name' - and MUST-MATCH being allowed to be
a function is quite new (June 2022).  If we have good reasons to change
the behavior because we find that the case when both MUST-MATCH and
PREDICATE are specified does not work intuitively I think it would still
be possible to tune it a bit.

But we have to know which behavior is more expected than what we
currently have.

Michael.





^ permalink raw reply	[relevance 5%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-10-04  3:35  5%                 ` Michael Heerdegen
@ 2023-10-04  5:22  5%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-05  1:12  5%                     ` Michael Heerdegen
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-04  5:22 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 66187, philipk


Michael Heerdegen <michael_heerdegen@web.de> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
>
>> Since completing-read is such a fundamental part of Emacs, I doubt it
>> will be possible to change this behavior.
>
> This is only about `read-file-name' - and MUST-MATCH being allowed to be
> a function is quite new (June 2022).  If we have good reasons to change
> the behavior because we find that the case when both MUST-MATCH and
> PREDICATE are specified does not work intuitively I think it would still
> be possible to tune it a bit.
>
> But we have to know which behavior is more expected than what we
> currently have.

My original expectations:

- PREDICATE narrows the list of completion candidates
- MUST-MATCH function determines whether to accept the input

I had thought that the two arguments would work independently of one
another.  IOW, the return value of MUST-MATCH would be the only factor
that determines whether input is accepted.  If MUST-MATCH returns
non-nil, the input is unconditionally accepted, and vice versa.

> This is only about `read-file-name'

Doesn't the unexpected behavior originate in completing-read?

Joseph





^ permalink raw reply	[relevance 5%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-10-03 20:43  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-04  6:05  0%                 ` Eli Zaretskii
  2023-10-04  6:25 10%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-10-04  6:05 UTC (permalink / raw)
  To: Joseph Turner; +Cc: michael_heerdegen, philipk, 66187

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: michael_heerdegen@web.de, philipk@posteo.net, 66187@debbugs.gnu.org
> Date: Tue, 03 Oct 2023 13:43:56 -0700
> 
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Cc: philipk@posteo.net, 66187@debbugs.gnu.org
> >> Date: Tue, 26 Sep 2023 17:55:37 -0700
> >> From:  Joseph Turner via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> >>
> >> > Finally, I think the docstring of `read-directory-name' needs to be
> >> > updated: it fails to mention that MUSTMATCH can be a function (the
> >> > argument is passed directly to `read-file-name').
> >>
> >> How about the attached patch?
> >
> > This is okay, except that we do document the other arguments.  So why
> > not just copy/paste the description of MUSTMATCH from read-file-name
> > to read-directory-name instead?
> 
> The read-file-name docstring for MUSTMATCH is lengthy, and duplicating
> it will mean that if read-file-name changes, we'll need to remember to
> change the docstring of read-directory-name.

That's true, but it doesn't sound like a grave problem to me.  We have
the same duplication elsewhere, so this isn't a precedent.  Moreover,
when a doc string is long and complicated, asking the reader to read
part of it elsewhere is also quite a hassle.

So I still think duplication is the lesser evil here.





^ permalink raw reply	[relevance 0%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-10-04  6:05  0%                 ` Eli Zaretskii
@ 2023-10-04  6:25 10%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-04  6:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael_heerdegen, philipk, 66187

[-- Attachment #1: Type: text/plain, Size: 1014 bytes --]


Eli Zaretskii <eliz@gnu.org> writes:

>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Cc: michael_heerdegen@web.de, philipk@posteo.net, 66187@debbugs.gnu.org
>> Date: Tue, 03 Oct 2023 13:43:56 -0700
>>
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> > This is okay, except that we do document the other arguments.  So why
>> > not just copy/paste the description of MUSTMATCH from read-file-name
>> > to read-directory-name instead?
>>
>> The read-file-name docstring for MUSTMATCH is lengthy, and duplicating
>> it will mean that if read-file-name changes, we'll need to remember to
>> change the docstring of read-directory-name.
>
> That's true, but it doesn't sound like a grave problem to me.  We have
> the same duplication elsewhere, so this isn't a precedent.  Moreover,
> when a doc string is long and complicated, asking the reader to read
> part of it elsewhere is also quite a hassle.
>
> So I still think duplication is the lesser evil here.

Thanks for the explanation! See patch.

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-MUSTMATCH-description-in-read-directory-name-doc.patch --]
[-- Type: text/x-diff, Size: 2014 bytes --]

From 3a653d681083d8d14d2d2437cb3f405dd7f07f04 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Tue, 26 Sep 2023 18:01:27 -0700
Subject: [PATCH] Fix MUSTMATCH description in read-directory-name docstring

* lisp/files.el (read-directory-name): Copy from read-file-name
description, replacing "file" with "directory".
---
 lisp/files.el | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index b72f141c0ee..c31cb13653e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -817,8 +817,23 @@ non-empty string that was inserted by this function.
 If the user exits with an empty minibuffer, this function returns
 an empty string.  (This can happen only if the user erased the
 pre-inserted contents or if `insert-default-directory' is nil.)
-Fourth arg MUSTMATCH non-nil means require existing directory's name.
- Non-nil and non-t means also require confirmation after completion.
+
+Fourth arg MUSTMATCH can take the following values:
+- nil means that the user can exit with any input.
+- t means that the user is not allowed to exit unless
+  the input is (or completes to) an existing directory.
+- `confirm' means that the user can exit with any input, but she needs
+  to confirm her choice if the input is not an existing directory.
+- `confirm-after-completion' means that the user can exit with any
+  input, but she needs to confirm her choice if she called
+  `minibuffer-complete' right before `minibuffer-complete-and-exit'
+  and the input is not an existing directory.
+- a function, which will be called with the input as the
+  argument.  If the function returns a non-nil value, the
+  minibuffer is exited with that argument as the value.
+- anything else behaves like t except that typing RET does not exit if it
+  does non-null completion.
+
 Fifth arg INITIAL specifies text to start with.
 DIR should be an absolute directory name.  It defaults to
 the value of `default-directory'."
-- 
2.41.0


^ permalink raw reply related	[relevance 10%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-10-03 21:18  9%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-04  3:35  5%                 ` Michael Heerdegen
@ 2023-10-04  7:03  0%                 ` Eli Zaretskii
    1 sibling, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-10-04  7:03 UTC (permalink / raw)
  To: Joseph Turner, Stefan Monnier; +Cc: michael_heerdegen, philipk, 66187

> Cc: philipk@posteo.net, 66187@debbugs.gnu.org
> Date: Tue, 03 Oct 2023 14:18:42 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> I dug a little more and realized that the IMO unexpected behavior
> resides in completing-read itself.  According to the completing-read
> docstring, its REQUIRE-MATCH argument can be
> 
> - a function, which will be called with the input as the
>   argument.  If the function returns a non-nil value, the
>   minibuffer is exited with that argument as the value.
> 
> I incorrectly assumed that this function would prevent matching items
> inside COLLECTION for which the function returns nil.  What it actually
> does it accept input which is not part of COLLECTION if the
> REQUIRE-MATCH function returns non-nil.  IOW, it doesn't narrow the
> potential completion options; it widens them.
> 
> For example, given:
> 
> (completing-read "Prompt: " '("a" "b") nil
>                  (lambda (input)
>                    (string= "a" input)))
> 
> I expected that the prompt would refuse to complete "b". I was wrong.
> 
> Since completing-read is such a fundamental part of Emacs, I doubt it
> will be possible to change this behavior.  What do you think about the
> attached patch to clarify the completing-read docstring?

I don't think I see how your proposed change clarifies this issue.

Adding Stefan for possibly more comments and ideas.





^ permalink raw reply	[relevance 0%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  2023-10-04  5:22  5%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-05  1:12  5%                     ` Michael Heerdegen
  0 siblings, 0 replies; 200+ results
From: Michael Heerdegen @ 2023-10-05  1:12 UTC (permalink / raw)
  To: 66187; +Cc: philipk, joseph

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> My original expectations:
>
> - PREDICATE narrows the list of completion candidates
> - MUST-MATCH function determines whether to accept the input
> [...]

> > This is only about `read-file-name'
>
> Doesn't the unexpected behavior originate in completing-read?

If that's the behavioral aspect you mean, then yes, the meaning of the
arguments is analogue, and they are passed to `completing-read'.

Michael.





^ permalink raw reply	[relevance 5%]

* bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
  2023-10-03 23:20  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-05  1:23  5%             ` Michael Heerdegen
  2023-10-05  1:34  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Michael Heerdegen @ 2023-10-05  1:23 UTC (permalink / raw)
  To: 66224; +Cc: philipk, joseph

Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> I'm not sure what you mean. In both of the following examples, PREDICATE
> is used to narrow the completion candidates to only empty directories:
>
> (read-directory-name "Prompt: " "~/" nil t nil #'directory-empty-p)
> (read-directory-name "Prompt: " "~/" nil nil nil #'directory-empty-p)

In the second version also non-empty directories will be accepted.

Michael.





^ permalink raw reply	[relevance 5%]

* bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name
  2023-10-05  1:23  5%             ` Michael Heerdegen
@ 2023-10-05  1:34  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-05  1:34 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 66224, philipk


Michael Heerdegen <michael_heerdegen@web.de> writes:

> Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
>
>> I'm not sure what you mean. In both of the following examples, PREDICATE
>> is used to narrow the completion candidates to only empty directories:
>>
>> (read-directory-name "Prompt: " "~/" nil t nil #'directory-empty-p)
>> (read-directory-name "Prompt: " "~/" nil nil nil #'directory-empty-p)
>
> In the second version also non-empty directories will be accepted.

Yes, PREDICATE narrows the completion candidates but doesn't determine a
valid return value.







^ permalink raw reply	[relevance 5%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
    @ 2023-10-06  4:45  0%                     ` Eli Zaretskii
  2023-10-06  5:55  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-10-06  4:45 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: michael_heerdegen, philipk, 66187, joseph

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Joseph Turner <joseph@breatheoutbreathe.in>,  michael_heerdegen@web.de,
>   philipk@posteo.net,  66187@debbugs.gnu.org
> Date: Thu, 05 Oct 2023 15:34:32 -0400
> 
> >> For example, given:
> >> 
> >> (completing-read "Prompt: " '("a" "b") nil
> >>                  (lambda (input)
> >>                    (string= "a" input)))
> >> 
> >> I expected that the prompt would refuse to complete "b". I was wrong.
> >> 
> >> Since completing-read is such a fundamental part of Emacs, I doubt it
> >> will be possible to change this behavior.  What do you think about the
> >> attached patch to clarify the completing-read docstring?
> 
> The use of a function as `require-match` is brand new in Emacs-29, so
> I think it's not too late to fix it.  I think rather than fixing the doc
> we should fix the behavior, e.g. with the patch below.

What change in behavior (wrt Emacs 29.1) does this patch cause?





^ permalink raw reply	[relevance 0%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
  @ 2023-10-06  4:47  0%                       ` Eli Zaretskii
  0 siblings, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-10-06  4:47 UTC (permalink / raw)
  To: Drew Adams; +Cc: michael_heerdegen, philipk, joseph, monnier, 66187

> From: Drew Adams <drew.adams@oracle.com>
> CC: "michael_heerdegen@web.de" <michael_heerdegen@web.de>,
>         "philipk@posteo.net" <philipk@posteo.net>,
>         "66187@debbugs.gnu.org"
> 	<66187@debbugs.gnu.org>,
>         Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Thu, 5 Oct 2023 20:20:46 +0000
> 
> > The use of a function as `require-match` is
> > brand new in Emacs-29, so I think it's not
> > too late to fix it.  I think rather than
> > fixing the doc we should fix the behavior 
> 
> If it's not too late to fix what was introduced
> in Emacs 29

That is not yet established.

> then how about not breaking the
> behavior of REQUIRE-MATCH at all, and instead
> just add a separate argument for what a function
> value of REQUIRE-MATCH does in 29.1?

That is definitely not a change suitable for Emacs 29 at this point.





^ permalink raw reply	[relevance 0%]

* bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function
      2023-10-06  4:45  0%                     ` Eli Zaretskii
@ 2023-10-06  5:55  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 0 replies; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-06  5:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: michael_heerdegen, Eli Zaretskii, philipk, 66187


Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> For example, given:
>>>
>>> (completing-read "Prompt: " '("a" "b") nil
>>>                  (lambda (input)
>>>                    (string= "a" input)))
>>>
>>> I expected that the prompt would refuse to complete "b". I was wrong.
>>>
>>> Since completing-read is such a fundamental part of Emacs, I doubt it
>>> will be possible to change this behavior.  What do you think about the
>>> attached patch to clarify the completing-read docstring?
>
> The use of a function as `require-match` is brand new in Emacs-29, so
> I think it's not too late to fix it.  I think rather than fixing the doc
> we should fix the behavior, e.g. with the patch below.
>
>
>         Stefan
>
>
> diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
> index 2120e31775e..d4da2d0d19b 100644
> --- a/lisp/minibuffer.el
> +++ b/lisp/minibuffer.el
> @@ -1835,15 +1835,13 @@ completion--complete-and-exit
>    (cond
>     ;; Allow user to specify null string
>     ((= beg end) (funcall exit-function))
> -   ;; The CONFIRM argument is a predicate.
> -   ((and (functionp minibuffer-completion-confirm)
> -         (funcall minibuffer-completion-confirm
> -                  (buffer-substring beg end)))
> -    (funcall exit-function))
>     ;; See if we have a completion from the table.
> -   ((test-completion (buffer-substring beg end)
> -                     minibuffer-completion-table
> -                     minibuffer-completion-predicate)
> +   ((if (functionp minibuffer-completion-confirm)
> +        (funcall minibuffer-completion-confirm
> +                 (buffer-substring beg end))
> +      (test-completion (buffer-substring beg end)
> +                       minibuffer-completion-table
> +                       minibuffer-completion-predicate))
>      ;; FIXME: completion-ignore-case has various slightly
>      ;; incompatible meanings.  E.g. it can reflect whether the user
>      ;; wants completion to pay attention to case, or whether the

Thank you!! The above change fixes completion--complete-and-exit:
attempting to exit with "b" now runs the final catchall cond clause.

However, the unexpected behavior persists (it is possible to exit with
"b") because the completion-function that completion-complete-and-exit
passes to completion--complete-and-exit returns "b" anyway since "b"
exactly matches one of elements of COLLECTION.

Thank you!

Joseph





^ permalink raw reply	[relevance 5%]

* bug#66393: [PATCH] Make package-vc-install-from-checkout NAME argument optional
@ 2023-10-07 18:40 10% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-08 15:43  5% ` Philip Kaludercic
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-07 18:40 UTC (permalink / raw)
  To: 66393; +Cc: Philip Kaludercic

[-- Attachment #1: Type: text/plain, Size: 118 bytes --]

Tags: patch

The purpose of this change is to simplify the noninteractive usage of package-vc-install-from-checkout.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-package-vc-install-from-checkout-NAME-argument-.patch --]
[-- Type: text/patch, Size: 1872 bytes --]

From cfdd990c6e00decff370e5f224d60862c13be309 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sat, 7 Oct 2023 11:38:43 -0700
Subject: [PATCH] Make package-vc-install-from-checkout NAME argument optional

* lisp/emacs-lisp/package-vc.el (package-vc-install-from-checkout):
Allow nil NAME; update documentation.
---
 lisp/emacs-lisp/package-vc.el | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index c7a30736e32..e47deca6d7a 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -841,18 +841,16 @@ for the last released version of the package."
     (find-file directory)))
 
 ;;;###autoload
-(defun package-vc-install-from-checkout (dir name)
+(defun package-vc-install-from-checkout (dir &optional name)
   "Set up the package NAME in DIR by linking it into the ELPA directory.
+NAME defaults to the base name of DIR.
 Interactively, prompt the user for DIR, which should be a directory
 under version control, typically one created by `package-vc-checkout'.
 If invoked interactively with a prefix argument, prompt the user
-for the NAME of the package to set up.  Otherwise infer the package
-name from the base name of DIR."
+for the NAME of the package to set up."
   (interactive (let ((dir (read-directory-name "Directory: ")))
-                 (list dir
-                       (if current-prefix-arg
-                           (read-string "Package name: ")
-                         (file-name-base (directory-file-name dir))))))
+                 (list dir (when current-prefix-arg
+                             (read-string "Package name: ")))))
   (unless (vc-responsible-backend dir)
     (user-error "Directory %S is not under version control" dir))
   (package-vc--archives-initialize)
-- 
2.41.0


^ permalink raw reply related	[relevance 10%]

* bug#65797: `buffer-match-p` should not use `func-arity`
  @ 2023-10-08  9:10  5%                           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-08 10:25  5%                             ` Dmitry Gutov
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-08  9:10 UTC (permalink / raw)
  To: Dmitry Gutov
  Cc: 65797, Philip Kaludercic, Mattias Engdegård, Stefan Monnier,
	Eli Zaretskii


Dmitry Gutov <dmitry@gutov.dev> writes:

> On 19/09/2023 16:56, Philip Kaludercic wrote:
>> Dmitry Gutov<dmitry@gutov.dev>  writes:
>>
>>> On 19/09/2023 11:34, Philip Kaludercic wrote:
>>>>> [ BTW, changing the code to use `&rest args` instead of `&optional arg`
>>>>>     would help for this, right?  ]
>>>> How come?
>>> In project.el buffer-match-p would be called without an extra
>>> argument, so the predicates would be called without an extra argument
>>> as well.
>>>
>>> That should take care of that compatibility, I think.
>> But what does that have to do with &rest vs &optional?
>
> Stringly speaking, nothing, because you can manage the same scheme
> with &optional - just dispatching to pred with different number of
> arguments depending on whether the &optional arg is nil. Though that
> breaks a little when nil is a meaningful value (probably a rare case).
>
> Rewriting the function in terms of &rest just makes this solution the
> most natural one, I suppose.

I am in favor of this solution as well.

> Though we'll still have to document the distinction in the docstrings
> of project-kill-buffer-conditions and etc (the number of the arguments
> called with).

How do the project.el docstrings need to be updated?

Thank you!

Joseph





^ permalink raw reply	[relevance 5%]

* bug#66403: [PATCH] Use delete-all-overlays in clean-mode
@ 2023-10-08  9:57 11% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-08 10:25  0% ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-08  9:57 UTC (permalink / raw)
  To: 66403

[-- Attachment #1: Type: text/plain, Size: 78 bytes --]

Tags: patch

Is there a reason to use dolist instead of delete-all-overlays?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-delete-all-overlays-in-clean-mode.patch --]
[-- Type: text/patch, Size: 902 bytes --]

From d47e0cbe9ecaeb0cd4da12ab70f03d4c138f9265 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sun, 8 Oct 2023 02:54:10 -0700
Subject: [PATCH] Use delete-all-overlays in clean-mode

* lisp/simple.el (clean-mode): Replace dolist
---
 lisp/simple.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index b770d9d7d33..8f2bd84d805 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -549,8 +549,7 @@ Other major modes are defined by comparison with this one."
   "A mode that removes all overlays and text properties."
   (kill-all-local-variables t)
   (let ((inhibit-read-only t))
-    (dolist (overlay (overlays-in (point-min) (point-max)))
-      (delete-overlay overlay))
+    (delete-all-overlays)
     (set-text-properties (point-min) (point-max) nil)
     (setq-local yank-excluded-properties t)))
 
-- 
2.41.0


^ permalink raw reply related	[relevance 11%]

* bug#66404: [PATCH] Use delete-all-overlays in clean-mode
@ 2023-10-08  9:58 11% Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-08 10:26  0% ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-08  9:58 UTC (permalink / raw)
  To: 66404

[-- Attachment #1: Type: text/plain, Size: 78 bytes --]

Tags: patch

Is there a reason to use dolist instead of delete-all-overlays?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-delete-all-overlays-in-clean-mode.patch --]
[-- Type: text/patch, Size: 902 bytes --]

From d47e0cbe9ecaeb0cd4da12ab70f03d4c138f9265 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sun, 8 Oct 2023 02:54:10 -0700
Subject: [PATCH] Use delete-all-overlays in clean-mode

* lisp/simple.el (clean-mode): Replace dolist
---
 lisp/simple.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index b770d9d7d33..8f2bd84d805 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -549,8 +549,7 @@ Other major modes are defined by comparison with this one."
   "A mode that removes all overlays and text properties."
   (kill-all-local-variables t)
   (let ((inhibit-read-only t))
-    (dolist (overlay (overlays-in (point-min) (point-max)))
-      (delete-overlay overlay))
+    (delete-all-overlays)
     (set-text-properties (point-min) (point-max) nil)
     (setq-local yank-excluded-properties t)))
 
-- 
2.41.0


^ permalink raw reply related	[relevance 11%]

* bug#66403: [PATCH] Use delete-all-overlays in clean-mode
  2023-10-08  9:57 11% bug#66403: [PATCH] Use delete-all-overlays in clean-mode Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-08 10:25  0% ` Eli Zaretskii
  0 siblings, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-10-08 10:25 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 66403

> Date: Sun, 08 Oct 2023 02:57:25 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Is there a reason to use dolist instead of delete-all-overlays?

Can the buffer be narrowed?





^ permalink raw reply	[relevance 0%]

* bug#65797: `buffer-match-p` should not use `func-arity`
  2023-10-08  9:10  5%                           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-08 10:25  5%                             ` Dmitry Gutov
  0 siblings, 0 replies; 200+ results
From: Dmitry Gutov @ 2023-10-08 10:25 UTC (permalink / raw)
  To: Joseph Turner
  Cc: 65797, Philip Kaludercic, Mattias Engdegård, Stefan Monnier,
	Eli Zaretskii

On 08/10/2023 12:10, Joseph Turner wrote:
>> Though we'll still have to document the distinction in the docstrings
>> of project-kill-buffer-conditions and etc (the number of the arguments
>> called with).
> How do the project.el docstrings need to be updated?

Bad phrasing on my part, sorry: no need to touch them in this particular 
patch. Or probably after (the number of args will stay unchanged).

But other similar variables, especially new ones, related to the user of 
buffer-match-p, would need to mention the number of args passed to PRED.





^ permalink raw reply	[relevance 5%]

* bug#66404: [PATCH] Use delete-all-overlays in clean-mode
  2023-10-08  9:58 11% bug#66404: " Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-08 10:26  0% ` Eli Zaretskii
  2023-10-08 10:32  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 200+ results
From: Eli Zaretskii @ 2023-10-08 10:26 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 66404

> Date: Sun, 08 Oct 2023 02:58:45 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Is there a reason to use dolist instead of delete-all-overlays?

Already asked.





^ permalink raw reply	[relevance 0%]

* bug#66404: [PATCH] Use delete-all-overlays in clean-mode
  2023-10-08 10:26  0% ` Eli Zaretskii
@ 2023-10-08 10:32  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-10-08 11:40  0%     ` Eli Zaretskii
  0 siblings, 1 reply; 200+ results
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-10-08 10:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 66404


Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Sun, 08 Oct 2023 02:58:45 -0700
>> From:  Joseph Turner via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>> Is there a reason to use dolist instead of delete-all-overlays?
>
> Already asked.

Oops! Sorry, please close this. (Is there a way for me to close my own issues?)





^ permalink raw reply	[relevance 5%]

* bug#66404: [PATCH] Use delete-all-overlays in clean-mode
  2023-10-08 10:32  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-08 11:40  0%     ` Eli Zaretskii
  0 siblings, 0 replies; 200+ results
From: Eli Zaretskii @ 2023-10-08 11:40 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 66404-done

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: 66404@debbugs.gnu.org
> Date: Sun, 08 Oct 2023 03:32:40 -0700
> 
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> Date: Sun, 08 Oct 2023 02:58:45 -0700
> >> From:  Joseph Turner via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> >>
> >> Is there a reason to use dolist instead of delete-all-overlays?
> >
> > Already asked.
> 
> Oops! Sorry, please close this.

Done.

> (Is there a way for me to close my own issues?)

Yes, see admin/notes/bugtracker.





^ permalink raw reply	[relevance 0%]

* bug#66393: [PATCH] Make package-vc-install-from-checkout NAME argument optional
  2023-10-07 18:40 10% bug#66393: [PATCH] Make package-vc-install-from-checkout NAME argument optional Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-10-08 15:43  5% ` Philip Kaludercic
  0 siblings, 0 replies; 200+ results
From: Philip Kaludercic @ 2023-10-08 15:43 UTC (permalink / raw)
  To: Joseph Turner; +Cc: 66393

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Tags: patch
>
> The purpose of this change is to simplify the noninteractive usage of package-vc-install-from-checkout.
>
> From cfdd990c6e00decff370e5f224d60862c13be309 Mon Sep 17 00:00:00 2001
> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Sat, 7 Oct 2023 11:38:43 -0700
> Subject: [PATCH] Make package-vc-install-from-checkout NAME argument optional
>
> * lisp/emacs-lisp/package-vc.el (package-vc-install-from-checkout):
> Allow nil NAME; update documentation.
> ---
>  lisp/emacs-lisp/package-vc.el | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
> index c7a30736e32..e47deca6d7a 100644
> --- a/lisp/emacs-lisp/package-vc.el
> +++ b/lisp/emacs-lisp/package-vc.el
> @@ -841,18 +841,16 @@ for the last released version of the package."
>      (find-file directory)))
>  
>  ;;;###autoload
> -(defun package-vc-install-from-checkout (dir name)
> +(defun package-vc-install-from-checkout (dir &optional name)
>    "Set up the package NAME in DIR by linking it into the ELPA directory.
> +NAME defaults to the base name of DIR.
>  Interactively, prompt the user for DIR, which should be a directory
>  under version control, typically one created by `package-vc-checkout'.
>  If invoked interactively with a prefix argument, prompt the user
> -for the NAME of the package to set up.  Otherwise infer the package
> -name from the base name of DIR."
> +for the NAME of the package to set up."
>    (interactive (let ((dir (read-directory-name "Directory: ")))
> -                 (list dir
> -                       (if current-prefix-arg
> -                           (read-string "Package name: ")
> -                         (file-name-base (directory-file-name dir))))))
> +                 (list dir (when current-prefix-arg

This looks fine, I'm just going to replace the `when' with a `and', ok?

> +                             (read-string "Package name: ")))))
>    (unless (vc-responsible-backend dir)
>      (user-error "Directory %S is not under version control" dir))
>    (package-vc--archives-initialize)





^ permalink raw reply	[relevance 5%]

Results 1-200 of ~500   | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2022-11-26 13:44     bug#59609: 29.0.50; [PATCH] Better advertise (Non-)GNU ELPA in emacs manual Stefan Kangas
2022-11-26 14:20     ` Eli Zaretskii
2023-09-08 11:25       ` Stefan Kangas
2023-09-08 11:56         ` Eli Zaretskii
2023-09-08 16:43           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-08 18:29             ` Eli Zaretskii
2023-09-08 20:10  5%           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-26 21:26  4% bug#60346: VC refresh error "Recursive load" Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-27 14:05  0% ` Eli Zaretskii
2023-01-08  4:48  5% bug#60643: 29.0.50; set-buffer-major-mode resets buffer local variables Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-08  5:45  5% ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-08  6:00  0% ` Eli Zaretskii
2023-01-08  9:09  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-08  9:09  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-06 20:39  9% bug#63336: [PATCH] package-vc: Process :make and :shell-command spec args Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-07  9:03  5% ` Philip Kaludercic
2023-05-07 18:47  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-08  8:42  0%     ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-08 19:38  9%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-10  6:35  5%     ` Philip Kaludercic
2023-05-11  1:37  9%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-14  7:44  5%         ` Philip Kaludercic
2023-05-14  8:08  8%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-14 19:30  5%             ` Philip Kaludercic
2023-05-14 23:01  8%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-15  9:12  5%                 ` Philip Kaludercic
2023-05-15 19:03  5%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-16 19:29                         ` Philip Kaludercic
2023-05-16 21:08  5%                       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-17 14:07  5%                         ` Philip Kaludercic
2023-05-13 17:18  0%       ` Philip Kaludercic
2023-05-06 20:54 10% bug#63337: [PATCH] package-vc--build-documentation: Fix relative @include statements Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-07  9:58  5% ` Philip Kaludercic
2023-05-07 10:56  0%   ` Eli Zaretskii
2023-05-07 18:40 10%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-07 19:11  0%     ` Eli Zaretskii
2023-05-07 19:19  0%       ` Philip Kaludercic
2023-05-07 20:29  9%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-08 13:51  5%           ` Philip Kaludercic
2023-05-08 19:05  9%             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-09  1:34  5%               ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-09  2:48  5%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-09  4:36  0%               ` Eli Zaretskii
2023-05-09 23:49 10%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-10  6:51  5%                   ` Philip Kaludercic
2023-05-11  2:04  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-12  6:51  5%                       ` Philip Kaludercic
2023-05-12  7:14                             ` Eli Zaretskii
2023-05-12  7:35                               ` Philip Kaludercic
2023-05-13  5:54  5%                             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-12  6:56  5%                       ` Philip Kaludercic
2023-05-13  5:47  5%                         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-13  8:41  5%     ` Philip Kaludercic
2023-05-13 16:38 10%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-13 17:14  5%         ` Philip Kaludercic
2023-05-13 18:31  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-15  3:57 10% bug#63509: [PATCH] Make copy-tree work with records Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-15 11:26  0% ` Eli Zaretskii
2023-05-15 17:59  7%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-18 10:53  0%     ` Eli Zaretskii
2023-05-18 19:05  7%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-19  6:07  0%         ` Eli Zaretskii
     [not found]     <871qvz4kdw.fsf@localhost>
2023-05-15  5:56 10% ` bug#63513: [PATCH] Make persist-defvar work with records and hash tables Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-15 11:31  0%   ` Eli Zaretskii
2023-05-23 20:14  9%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-02 23:54  9%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-03  6:08  0%         ` Eli Zaretskii
2023-09-04  0:29  8%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04 11:33  0%             ` Eli Zaretskii
2023-09-04 15:57  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04 17:05  5%                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04 22:28  8%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-05 21:06                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-08 11:30                           ` Ihor Radchenko
2023-09-08 11:58  0%                         ` Eli Zaretskii
2023-09-08 16:36                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-08 17:06                               ` Ihor Radchenko
2023-09-08 17:10  5%                             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-09 10:01  5%                               ` Ihor Radchenko
2023-09-09 10:15  0%                                 ` Daniel Mendler
2023-09-05 15:08  0%                   ` phillip.lord
2023-05-23 19:32  5% bug#63671: Add function to test equality of " Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-24  9:27     Mattias Engdegård
2023-05-24 17:27  5% ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-24 20:01  5%   ` Ihor Radchenko
2023-05-24 20:34  4%   ` Mattias Engdegård
2023-05-25  2:44  5%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-25  6:31  5%       ` Ihor Radchenko
2023-05-25  7:22  5%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-25  7:22  5%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-20  6:19  5% bug#64739: (forward-thing 'number) doesn't work with decimal numbers Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-20  6:39  0% ` Eli Zaretskii
2023-07-21 12:28       ` Roland Winkler
2023-07-21 12:48  0%     ` Eli Zaretskii
2023-07-21 12:52  0%       ` Eli Zaretskii
2023-07-21 14:14             ` Roland Winkler
2023-07-21 14:29               ` Eli Zaretskii
2023-07-23  3:36  5%             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-23  5:33  0%               ` Eli Zaretskii
2023-07-23 19:03  4%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-24 11:25  0%                   ` Eli Zaretskii
2023-07-26 12:21                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-29 23:01  5%                       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-12  8:43 10% bug#65243: [PATCH] Fix building of VC package manuals with relative org links/includes Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-14  8:14  5% ` Philip Kaludercic
2023-08-14 12:11  0%   ` Eli Zaretskii
2023-08-15  1:57  4%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-19  9:46  5% ` Philip Kaludercic
2023-08-21  4:06  5% bug#65414: save-some-buffers-functions are unexpectedly called when save-some-buffers pred is non-nil Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-21 11:56  0% ` Eli Zaretskii
2023-08-23 23:57  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-24  5:16  0%     ` Eli Zaretskii
2023-08-26  6:38  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-26  7:26  0%         ` Eli Zaretskii
2023-08-26  7:32 10%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-02  7:30  0%             ` Eli Zaretskii
2023-09-03 17:06                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-03 17:29  0%                 ` Eli Zaretskii
2023-09-03 17:52  5%                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-03 19:03                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-03 19:04  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04 10:53  0%                   ` Eli Zaretskii
2023-09-04 15:54  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-04 15:59  0%                       ` Eli Zaretskii
2023-09-03 17:22                   ` Juri Linkov
2023-09-03 17:44  0%                 ` Eli Zaretskii
     [not found]     <87r0nqct63.fsf@breatheoutbreathe.in>
2023-08-30  7:10 11% ` bug#65608: Fwd: [PATCH] project.el: Use list of strings p for safe local variable Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-30 11:22  5%   ` Dmitry Gutov
2023-08-30 17:54  0%     ` Stefan Kangas
2023-08-31  6:26  9% bug#65649: [PATCH] package-vc: Continue installing package when documentation build fails Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-31  6:32  9% ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-31  6:34 11%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-31  7:18  5%     ` Philip Kaludercic
2023-08-31 21:19  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-31 21:39 11%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-01 13:14  7%         ` Philip Kaludercic
2023-09-01 23:28  9%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-02 12:03  5%             ` Philip Kaludercic
2023-09-02 16:49  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-03  7:00  5%                 ` Philip Kaludercic
2023-08-31  6:50  0% ` Eli Zaretskii
2023-08-31 21:47  4% bug#65666: Lockfiles break package-vc-install-from-checkout Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-01  5:50  0% ` Eli Zaretskii
2023-09-01  6:18  5% ` joseph--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-01 12:52  0%   ` Philip Kaludercic
2023-09-01 23:43  5%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-02  7:49  0%       ` Eli Zaretskii
2023-09-02 17:15 10%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-02 17:21  0%           ` Eli Zaretskii
2023-09-03  7:03  0%             ` Philip Kaludercic
2023-09-05 19:35 11% bug#65764: Fix typo in backward-word-strictly Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-05 19:50  5% ` Stefan Kangas
2023-09-06  2:13 11% bug#65768: Bump persist.el version Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-06 16:39  5% ` Stefan Kangas
2023-09-16 22:28  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-30 14:30 11%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-07  7:53  1% bug#65797: 29.0.92; func-arity should not return (0 . many) with apply-partially Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-07 15:50     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-08  4:40  7%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-08  6:46  0%     ` Eli Zaretskii
2023-09-08 15:52           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-08 16:37  5%         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-08 17:18               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-08 18:16  5%             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-08 18:20  0%         ` Eli Zaretskii
2023-09-11 16:57  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-11 18:58  0%             ` Eli Zaretskii
2023-09-08 17:01       ` bug#65797: `buffer-match-p` should not use `func-arity` Philip Kaludercic
2023-09-12 18:28         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-13 21:50           ` Philip Kaludercic
2023-09-14 13:47             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-18  9:12               ` Philip Kaludercic
2023-09-18 11:55                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-18 17:23                   ` Philip Kaludercic
2023-09-18 18:05                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-19  8:34                       ` Philip Kaludercic
2023-09-19 10:06                         ` Dmitry Gutov
2023-09-19 13:56                           ` Philip Kaludercic
2023-09-19 16:13                             ` Dmitry Gutov
2023-10-08  9:10  5%                           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-08 10:25  5%                             ` Dmitry Gutov
2023-09-15  0:45         ` Dmitry Gutov
2023-09-15  1:38           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-15 16:38             ` Dmitry Gutov
2023-09-15 17:54  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-15 18:00  5%             ` Dmitry Gutov
2023-09-20  7:02  9% bug#66114: [PATCH] Fix interactive prompt for selecting checkout directory Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]     ` <handler.66114.B.16951935749180.ack@debbugs.gnu.org>
2023-09-20  7:24  9%   ` bug#66114: Acknowledgement ([PATCH] Fix interactive prompt for selecting checkout directory) Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-20  7:31  9%     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-22  8:21  5% ` bug#66114: [PATCH] Fix interactive prompt for selecting checkout directory Philip Kaludercic
2023-09-24  5:06  4%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-24 14:37  5%     ` Philip Kaludercic
2023-09-24 21:27  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-20  7:14 10% bug#66115: [PATCH] Ensure that directory is expanded in package-vc-checkout Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-22  8:17  5% ` Philip Kaludercic
2023-09-22  8:33  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-22 10:51  5%     ` Philip Kaludercic
2023-09-24  5:34  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-24  6:54  0%         ` Eli Zaretskii
2023-09-24 21:31  5% bug#66187: read-file-name unexpected behavior when MUSTMATCH is a function Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-25  3:58  5% ` Michael Heerdegen
2023-09-25  5:12  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-25 21:33  5%     ` Michael Heerdegen
2023-09-26  8:37  5%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-27  0:26  5%         ` Michael Heerdegen
2023-09-27  0:55 10%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-27  1:43  4%             ` Michael Heerdegen
2023-10-03 21:18  9%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-04  3:35  5%                 ` Michael Heerdegen
2023-10-04  5:22  5%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-05  1:12  5%                     ` Michael Heerdegen
2023-10-04  7:03  0%                 ` Eli Zaretskii
2023-10-05 19:34                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-05 20:20                         ` Drew Adams
2023-10-06  4:47  0%                       ` Eli Zaretskii
2023-10-06  4:45  0%                     ` Eli Zaretskii
2023-10-06  5:55  5%                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-29 12:00  0%             ` Eli Zaretskii
2023-10-03 20:43  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-04  6:05  0%                 ` Eli Zaretskii
2023-10-04  6:25 10%                   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-27  1:16  8% bug#66224: [PATCH] Add optional PREDICATE argument to read-directory-name Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-28  9:05  5% ` Philip Kaludercic
2023-09-29  3:28  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-29  3:54  5%     ` Michael Heerdegen
2023-09-29  4:19  8%       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-03  3:30  5%         ` Michael Heerdegen
2023-10-03 23:20  5%           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-05  1:23  5%             ` Michael Heerdegen
2023-10-05  1:34  5%               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-29  3:28  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-29 12:05  0% ` Eli Zaretskii
2023-10-03 23:08  8%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-07 18:40 10% bug#66393: [PATCH] Make package-vc-install-from-checkout NAME argument optional Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-08 15:43  5% ` Philip Kaludercic
2023-10-08  9:57 11% bug#66403: [PATCH] Use delete-all-overlays in clean-mode Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-08 10:25  0% ` Eli Zaretskii
2023-10-08  9:58 11% bug#66404: " Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-08 10:26  0% ` Eli Zaretskii
2023-10-08 10:32  5%   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-08 11:40  0%     ` Eli Zaretskii

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