APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1553721036 0
# Wed Mar 27 21:10:36 2019 +0000
# Node ID 981577593cb6a67bea720c2f55fd74447f1b508f
# Parent 8110c5579c84377541e0dc765bea9cec942292f0
Drop #'user-name-completion-1, give multiple vals in #'user-name-completion
src/ChangeLog addition:
2019-03-27 Aidan Kehoe <kehoea(a)parhasard.net>
* dired.c:
* dired.c (Fuser_name_completion):
* dired.c (user_name_completion):
* dired.c (syms_of_dired):
Remove Fuser_name_completion_1(), return its CDR as the second
value from Fuser_name_completion() instead.
lisp/ChangeLog addition:
2019-03-27 Aidan Kehoe <kehoea(a)parhasard.net>
* minibuf.el (read-file-name-internal-1):
Revise this now #'user-name-completion returns two values and
#'user-name-completion-1 is no longer available.
diff -r 8110c5579c84 -r 981577593cb6 lisp/ChangeLog
--- a/lisp/ChangeLog Fri Mar 22 07:41:56 2019 +0000
+++ b/lisp/ChangeLog Wed Mar 27 21:10:36 2019 +0000
@@ -49,6 +49,12 @@
* x-misc.el (default-x-device): New.
Move this from device-x.c.
+2019-03-27 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * minibuf.el (read-file-name-internal-1):
+ Revise this now #'user-name-completion returns two values and
+ #'user-name-completion-1 is no longer available.
+
2011-03-05 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el:
diff -r 8110c5579c84 -r 981577593cb6 lisp/minibuf.el
--- a/lisp/minibuf.el Fri Mar 22 07:41:56 2019 +0000
+++ b/lisp/minibuf.el Wed Mar 27 21:10:36 2019 +0000
@@ -1728,25 +1728,22 @@
(name (if orig (file-name-nondirectory sstring) string))
(direct (if specdir (expand-file-name specdir dir) dir)))
;; ~username completion
- (if (and (fboundp 'user-name-completion-1)
- (string-match "^[~]" name))
+ (if (and (> (length name) 0) (eql ?~ (aref name 0)))
(let ((user (substring name 1)))
(cond ((eq action 'lambda)
(file-directory-p name))
- ((eq action 't)
+ ((eq action t)
;; all completions
(mapcar #'(lambda (p) (concat "~" p))
- (declare-fboundp
- (user-name-all-completions user))))
+ (user-name-all-completions user)))
(t;; 'nil
;; complete
- (let* ((val+uniq (declare-fboundp
- (user-name-completion-1 user)))
- (val (car val+uniq))
- (uniq (cdr val+uniq)))
+ (multiple-value-bind (val uniq)
+ (user-name-completion user)
(cond ((stringp val)
(if uniq
- (file-name-as-directory (concat "~" val))
+ (file-name-as-directory
+ (concat "~" val))
(concat "~" val)))
((eq val t)
(file-name-as-directory name))
diff -r 8110c5579c84 -r 981577593cb6 src/ChangeLog
--- a/src/ChangeLog Fri Mar 22 07:41:56 2019 +0000
+++ b/src/ChangeLog Wed Mar 27 21:10:36 2019 +0000
@@ -69,6 +69,15 @@
Call #'prefix-numeric-value through its Lisp symbol here, now it's
no longer in C.
+2019-03-27 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * dired.c:
+ * dired.c (Fuser_name_completion):
+ * dired.c (user_name_completion):
+ * dired.c (syms_of_dired):
+ Remove Fuser_name_completion_1(), return its CDR as the second
+ value from Fuser_name_completion() instead.
+
2019-03-10 Aidan Kehoe <kehoea(a)parhasard.net>
Mechanically change byte_marker_position() to
diff -r 8110c5579c84 -r 981577593cb6 src/dired.c
--- a/src/dired.c Fri Mar 22 07:41:56 2019 +0000
+++ b/src/dired.c Wed Mar 27 21:10:36 2019 +0000
@@ -513,39 +513,26 @@
static Lisp_Object user_name_completion (Lisp_Object user,
int all_flag,
- int *uniq);
+ Lisp_Object *uniq);
DEFUN ("user-name-completion", Fuser_name_completion, 1, 1, 0, /*
Complete user name from PARTIAL-USERNAME.
+
Return the longest prefix common to all user names starting with
PARTIAL-USERNAME. If there is only one and PARTIAL-USERNAME matches
it exactly, returns t. Return nil if there is no user name starting
with PARTIAL-USERNAME.
+
+This function returns two values, see `multiple-value-bind'. The second value
+is non-nil if and only if the completion returned as the first value was
+unique.
*/
(partial_username))
{
- return user_name_completion (partial_username, 0, NULL);
-}
-
-DEFUN ("user-name-completion-1", Fuser_name_completion_1, 1, 1, 0, /*
-Complete user name from PARTIAL-USERNAME.
-
-This function is identical to `user-name-completion', except that
-the cons of the completion and an indication of whether the
-completion was unique is returned.
+ Lisp_Object valz[] = { Qnil, Qnil };
-The car of the returned value is the longest prefix common to all user
-names that start with PARTIAL-USERNAME. If there is only one and
-PARTIAL-USERNAME matches it exactly, the car is t. The car is nil if
-there is no user name starting with PARTIAL-USERNAME. The cdr of the
-result is non-nil if and only if the completion returned in the car
-was unique.
-*/
- (partial_username))
-{
- int uniq;
- Lisp_Object completed = user_name_completion (partial_username, 0, &uniq);
- return Fcons (completed, uniq ? Qt : Qnil);
+ valz[0] = user_name_completion (partial_username, 0, valz + 1);
+ return Fvalues (countof (valz), valz);
}
DEFUN ("user-name-all-completions", Fuser_name_all_completions, 1, 1, 0, /*
@@ -601,7 +588,7 @@
#define USER_CACHE_TTL (24*60*60) /* Time to live: 1 day, in seconds */
static Lisp_Object
-user_name_completion (Lisp_Object user, int all_flag, int *uniq)
+user_name_completion (Lisp_Object user, int all_flag, Lisp_Object *uniq)
{
/* This function can GC */
int matchcount = 0;
@@ -765,7 +752,7 @@
UNGCPRO;
if (uniq)
- *uniq = (matchcount == 1);
+ *uniq = (matchcount == 1) ? Qt : Qnil;
if (all_flag || NILP (bestmatch))
return bestmatch;
@@ -968,7 +955,6 @@
DEFSUBR (Ffile_name_completion);
DEFSUBR (Ffile_name_all_completions);
DEFSUBR (Fuser_name_completion);
- DEFSUBR (Fuser_name_completion_1);
DEFSUBR (Fuser_name_all_completions);
DEFSUBR (Ffile_attributes);
}
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)