From 274ec97e3c65ab082264867ba3531cb853f491a9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 29 Apr 2020 17:52:53 +0300 Subject: [PATCH 1/3] Make sure alist-related functions say so in their doc * src/fns.c (Fassq, assq_no_quit, Fassoc, assoc_no_quit, Frassq) (Frassoc): Rename argument LIST to ALIST. Doc strings updated. --- src/fns.c | 56 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/fns.c b/src/fns.c index 3b5feace521..392196e2c7a 100644 --- a/src/fns.c +++ b/src/fns.c @@ -1604,16 +1604,16 @@ The value is actually the tail of LIST whose car is ELT. */) } DEFUN ("assq", Fassq, Sassq, 2, 2, 0, - doc: /* Return non-nil if KEY is `eq' to the car of an element of LIST. -The value is actually the first element of LIST whose car is KEY. -Elements of LIST that are not conses are ignored. */) - (Lisp_Object key, Lisp_Object list) + doc: /* Return non-nil if KEY is `eq' to the car of an element of ALIST. +The value is actually the first element of ALIST whose car is KEY. +Elements of ALIST that are not conses are ignored. */) + (Lisp_Object key, Lisp_Object alist) { - Lisp_Object tail = list; + Lisp_Object tail = alist; FOR_EACH_TAIL (tail) if (CONSP (XCAR (tail)) && EQ (XCAR (XCAR (tail)), key)) return XCAR (tail); - CHECK_LIST_END (tail, list); + CHECK_LIST_END (tail, alist); return Qnil; } @@ -1621,22 +1621,22 @@ Elements of LIST that are not conses are ignored. */) Use only on objects known to be non-circular lists. */ Lisp_Object -assq_no_quit (Lisp_Object key, Lisp_Object list) +assq_no_quit (Lisp_Object key, Lisp_Object alist) { - for (; ! NILP (list); list = XCDR (list)) - if (CONSP (XCAR (list)) && EQ (XCAR (XCAR (list)), key)) - return XCAR (list); + for (; ! NILP (alist); alist = XCDR (alist)) + if (CONSP (XCAR (alist)) && EQ (XCAR (XCAR (alist)), key)) + return XCAR (alist); return Qnil; } DEFUN ("assoc", Fassoc, Sassoc, 2, 3, 0, - doc: /* Return non-nil if KEY is equal to the car of an element of LIST. -The value is actually the first element of LIST whose car equals KEY. + doc: /* Return non-nil if KEY is equal to the car of an element of ALIST. +The value is actually the first element of ALIST whose car equals KEY. Equality is defined by TESTFN if non-nil or by `equal' if nil. */) - (Lisp_Object key, Lisp_Object list, Lisp_Object testfn) + (Lisp_Object key, Lisp_Object alist, Lisp_Object testfn) { - Lisp_Object tail = list; + Lisp_Object tail = alist; FOR_EACH_TAIL (tail) { Lisp_Object car = XCAR (tail); @@ -1647,7 +1647,7 @@ Equality is defined by TESTFN if non-nil or by `equal' if nil. */) : !NILP (call2 (testfn, XCAR (car), key)))) return car; } - CHECK_LIST_END (tail, list); + CHECK_LIST_END (tail, alist); return Qnil; } @@ -1656,11 +1656,11 @@ Equality is defined by TESTFN if non-nil or by `equal' if nil. */) that are not too deep and are not window configurations. */ Lisp_Object -assoc_no_quit (Lisp_Object key, Lisp_Object list) +assoc_no_quit (Lisp_Object key, Lisp_Object alist) { - for (; ! NILP (list); list = XCDR (list)) + for (; ! NILP (alist); alist = XCDR (alist)) { - Lisp_Object car = XCAR (list); + Lisp_Object car = XCAR (alist); if (CONSP (car) && (EQ (XCAR (car), key) || equal_no_quit (XCAR (car), key))) return car; @@ -1669,24 +1669,24 @@ assoc_no_quit (Lisp_Object key, Lisp_Object list) } DEFUN ("rassq", Frassq, Srassq, 2, 2, 0, - doc: /* Return non-nil if KEY is `eq' to the cdr of an element of LIST. -The value is actually the first element of LIST whose cdr is KEY. */) - (Lisp_Object key, Lisp_Object list) + doc: /* Return non-nil if KEY is `eq' to the cdr of an element of ALIST. +The value is actually the first element of ALIST whose cdr is KEY. */) + (Lisp_Object key, Lisp_Object alist) { - Lisp_Object tail = list; + Lisp_Object tail = alist; FOR_EACH_TAIL (tail) if (CONSP (XCAR (tail)) && EQ (XCDR (XCAR (tail)), key)) return XCAR (tail); - CHECK_LIST_END (tail, list); + CHECK_LIST_END (tail, alist); return Qnil; } DEFUN ("rassoc", Frassoc, Srassoc, 2, 2, 0, - doc: /* Return non-nil if KEY is `equal' to the cdr of an element of LIST. -The value is actually the first element of LIST whose cdr equals KEY. */) - (Lisp_Object key, Lisp_Object list) + doc: /* Return non-nil if KEY is `equal' to the cdr of an element of ALIST. +The value is actually the first element of ALIST whose cdr equals KEY. */) + (Lisp_Object key, Lisp_Object alist) { - Lisp_Object tail = list; + Lisp_Object tail = alist; FOR_EACH_TAIL (tail) { Lisp_Object car = XCAR (tail); @@ -1694,7 +1694,7 @@ The value is actually the first element of LIST whose cdr equals KEY. */) && (EQ (XCDR (car), key) || !NILP (Fequal (XCDR (car), key)))) return car; } - CHECK_LIST_END (tail, list); + CHECK_LIST_END (tail, alist); return Qnil; } From 7a12ab5ea2257f8e9d3f4ba03918cf9709a728e1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 29 Apr 2020 18:58:42 +0300 Subject: [PATCH 2/3] Fix project.el commands in "transient" projects * lisp/progmodes/project.el (project--files-in-directory): Run local DIR directory names through 'expand-file-name', so that "~/" is expanded, in case the shell doesn't or the shell's notion of the home directory is different from that of Emacs. (Bug#40940) --- lisp/progmodes/project.el | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 1f4cbe96ad8..dbc967b8851 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -185,23 +185,27 @@ to find the list of ignores for each directory." (require 'find-dired) (require 'xref) (defvar find-name-arg) - (let ((default-directory dir) - (command (format "%s %s %s -type f %s -print0" - find-program - (file-local-name dir) - (xref--find-ignores-arguments - ignores - (expand-file-name dir)) - (if files - (concat (shell-quote-argument "(") - " " find-name-arg " " - (mapconcat - #'shell-quote-argument - (split-string files) - (concat " -o " find-name-arg " ")) - " " - (shell-quote-argument ")"))"") - ))) + (let* ((default-directory dir) + (dirname (file-remote-p dir 'localname)) + (dirname (or dirname + ;; Make sure ~/ etc. in local directory name is + ;; expanded and not left for the shell command + ;; to interpret. + (expand-file-name dir))) + (command (format "%s %s %s -type f %s -print0" + find-program + dirname + (xref--find-ignores-arguments ignores dirname) + (if files + (concat (shell-quote-argument "(") + " " find-name-arg " " + (mapconcat + #'shell-quote-argument + (split-string files) + (concat " -o " find-name-arg " ")) + " " + (shell-quote-argument ")"))"") + ))) (project--remote-file-names (sort (split-string (shell-command-to-string command) "\0" t) #'string<)))) From 1f17193e00692b1bb9739415b0b56ed8f16f049f Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Wed, 29 Apr 2020 22:46:17 +0300 Subject: [PATCH 3/3] Expand file name for remote dirs as well * lisp/progmodes/project.el (project--files-in-directory): Expand file name for remote dirs as well (bug#40940). --- lisp/progmodes/project.el | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index dbc967b8851..f5f4092babf 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -186,16 +186,14 @@ to find the list of ignores for each directory." (require 'xref) (defvar find-name-arg) (let* ((default-directory dir) - (dirname (file-remote-p dir 'localname)) - (dirname (or dirname - ;; Make sure ~/ etc. in local directory name is - ;; expanded and not left for the shell command - ;; to interpret. - (expand-file-name dir))) + ;; Make sure ~/ etc. in local directory name is + ;; expanded and not left for the shell command + ;; to interpret. + (localdir (file-local-name (expand-file-name dir))) (command (format "%s %s %s -type f %s -print0" find-program - dirname - (xref--find-ignores-arguments ignores dirname) + localdir + (xref--find-ignores-arguments ignores localdir) (if files (concat (shell-quote-argument "(") " " find-name-arg " "