diff options
| author | Juri Linkov | 2009-11-10 00:54:45 +0000 |
|---|---|---|
| committer | Juri Linkov | 2009-11-10 00:54:45 +0000 |
| commit | 032c33996ae4358d9a7d99cb852146bb08e06352 (patch) | |
| tree | 3de14163928046e3072a91494c80b14e87ab62ee | |
| parent | a51203eebdc5a8440942f265b43e73858947b26d (diff) | |
| download | emacs-032c33996ae4358d9a7d99cb852146bb08e06352.tar.gz emacs-032c33996ae4358d9a7d99cb852146bb08e06352.zip | |
(read-file-name): Support a list of default values
in `default-filename'. Use the first file name where only one
element is required. Doc fix.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/minibuffer.el | 19 |
2 files changed, 20 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fa68d679c8b..158e493fde0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2009-11-10 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | * minibuffer.el (read-file-name): Support a list of default values | ||
| 4 | in `default-filename'. Use the first file name where only one | ||
| 5 | element is required. Doc fix. | ||
| 6 | |||
| 1 | 2009-11-09 Michael Albinus <michael.albinus@gmx.de> | 7 | 2009-11-09 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 8 | ||
| 3 | * net/dbus.el (dbus-unregister-object): Release service, if no | 9 | * net/dbus.el (dbus-unregister-object): Release service, if no |
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 59732fd4b8a..823b56e7125 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -1265,7 +1265,8 @@ Value is not expanded---you must call `expand-file-name' yourself. | |||
| 1265 | Default name to DEFAULT-FILENAME if user exits the minibuffer with | 1265 | Default name to DEFAULT-FILENAME if user exits the minibuffer with |
| 1266 | the same non-empty string that was inserted by this function. | 1266 | the same non-empty string that was inserted by this function. |
| 1267 | (If DEFAULT-FILENAME is omitted, the visited file name is used, | 1267 | (If DEFAULT-FILENAME is omitted, the visited file name is used, |
| 1268 | except that if INITIAL is specified, that combined with DIR is used.) | 1268 | except that if INITIAL is specified, that combined with DIR is used. |
| 1269 | If DEFAULT-FILENAME is a list of file names, the first file name is used.) | ||
| 1269 | If the user exits with an empty minibuffer, this function returns | 1270 | If the user exits with an empty minibuffer, this function returns |
| 1270 | an empty string. (This can only happen if the user erased the | 1271 | an empty string. (This can only happen if the user erased the |
| 1271 | pre-inserted contents or if `insert-default-directory' is nil.) | 1272 | pre-inserted contents or if `insert-default-directory' is nil.) |
| @@ -1308,7 +1309,10 @@ and `read-file-name-function'." | |||
| 1308 | (setq dir (abbreviate-file-name dir)) | 1309 | (setq dir (abbreviate-file-name dir)) |
| 1309 | ;; Likewise for default-filename. | 1310 | ;; Likewise for default-filename. |
| 1310 | (if default-filename | 1311 | (if default-filename |
| 1311 | (setq default-filename (abbreviate-file-name default-filename))) | 1312 | (setq default-filename |
| 1313 | (if (consp default-filename) | ||
| 1314 | (mapcar 'abbreviate-file-name default-filename) | ||
| 1315 | (abbreviate-file-name default-filename)))) | ||
| 1312 | (let ((insdef (cond | 1316 | (let ((insdef (cond |
| 1313 | ((and insert-default-directory (stringp dir)) | 1317 | ((and insert-default-directory (stringp dir)) |
| 1314 | (if initial | 1318 | (if initial |
| @@ -1357,9 +1361,12 @@ and `read-file-name-function'." | |||
| 1357 | (not (zerop (length file)))) | 1361 | (not (zerop (length file)))) |
| 1358 | (setq default-filename file) | 1362 | (setq default-filename file) |
| 1359 | (setq dir (file-name-directory dir))) | 1363 | (setq dir (file-name-directory dir))) |
| 1360 | (if default-filename | 1364 | (when default-filename |
| 1361 | (setq default-filename | 1365 | (setq default-filename |
| 1362 | (expand-file-name default-filename dir))) | 1366 | (expand-file-name (if (consp default-filename) |
| 1367 | (car default-filename) | ||
| 1368 | default-filename) | ||
| 1369 | dir))) | ||
| 1363 | (setq add-to-history t) | 1370 | (setq add-to-history t) |
| 1364 | (x-file-dialog prompt dir default-filename | 1371 | (x-file-dialog prompt dir default-filename |
| 1365 | dialog-mustmatch | 1372 | dialog-mustmatch |
| @@ -1371,6 +1378,8 @@ and `read-file-name-function'." | |||
| 1371 | ;; it has to mean that the user typed RET with the minibuffer empty. | 1378 | ;; it has to mean that the user typed RET with the minibuffer empty. |
| 1372 | ;; In that case, we really want to return "" | 1379 | ;; In that case, we really want to return "" |
| 1373 | ;; so that commands such as set-visited-file-name can distinguish. | 1380 | ;; so that commands such as set-visited-file-name can distinguish. |
| 1381 | (when (consp default-filename) | ||
| 1382 | (setq default-filename (car default-filename))) | ||
| 1374 | (when (eq val default-filename) | 1383 | (when (eq val default-filename) |
| 1375 | ;; In this case, completing-read has not added an element | 1384 | ;; In this case, completing-read has not added an element |
| 1376 | ;; to the history. Maybe we should. | 1385 | ;; to the history. Maybe we should. |