comparison lisp/minibuf.el @ 371:cc15677e0335 r21-2b1

Import from CVS: tag r21-2b1
author cvs
date Mon, 13 Aug 2007 11:03:08 +0200
parents a4f53d9b3154
children 6240c7796c7a
comparison
equal deleted inserted replaced
370:bd866891f083 371:cc15677e0335
39 ;; (following|preceding)-char. -slb 39 ;; (following|preceding)-char. -slb
40 40
41 ;;; Code: 41 ;;; Code:
42 42
43 (defgroup minibuffer nil 43 (defgroup minibuffer nil
44 "Controling the behavior of the minibuffer." 44 "Controling the behaviour of the minibuffer."
45 :group 'environment) 45 :group 'environment)
46 46
47 47
48 (defcustom insert-default-directory t 48 (defcustom insert-default-directory t
49 "*Non-nil means when reading a filename start with default dir in minibuffer." 49 "*Non-nil means when reading a filename start with default dir in minibuffer."
50 :type 'boolean 50 :type 'boolean
51 :group 'minibuffer) 51 :group 'minibuffer)
52 52
53 (defcustom minibuffer-history-uniquify t 53 (defcustom minibuffer-history-uniquify t
54 "*Non-nil means when adding an item to a minibuffer history, remove 54 "*Non-nil means when adding an item to a minibuffer history, remove
55 previous occurrences of the same item from the history list first, 55 previous occurances of the same item from the history list first,
56 rather than just consing the new element onto the front of the list." 56 rather than just consing the new element onto the front of the list."
57 :type 'boolean 57 :type 'boolean
58 :group 'minibuffer) 58 :group 'minibuffer)
59 59
60 (defvar minibuffer-completion-table nil 60 (defvar minibuffer-completion-table nil
240 (eq directory-sep-char (char-before (point))) 240 (eq directory-sep-char (char-before (point)))
241 ;; permit URL's with //, for e.g. http://hostname/~user 241 ;; permit URL's with //, for e.g. http://hostname/~user
242 (not (save-excursion (search-backward "//" nil t))) 242 (not (save-excursion (search-backward "//" nil t)))
243 (delete-region (point-min) (point))) 243 (delete-region (point-min) (point)))
244 (insert ?~)) 244 (insert ?~))
245
246 245
247 (defvar read-file-name-map 246 (defvar read-file-name-map
248 (let ((map (make-sparse-keymap 'read-file-name-map))) 247 (let ((map (make-sparse-keymap 'read-file-name-map)))
249 (set-keymap-parents map (list minibuffer-local-completion-map)) 248 (set-keymap-parents map (list minibuffer-local-completion-map))
250 (define-key map (vector directory-sep-char) 'minibuffer-electric-separator) 249 (define-key map (vector directory-sep-char) 'minibuffer-electric-separator)
446 (setq current-minibuffer-contents (car initial-contents) 445 (setq current-minibuffer-contents (car initial-contents)
447 current-minibuffer-point (cdr initial-contents))) 446 current-minibuffer-point (cdr initial-contents)))
448 (insert initial-contents) 447 (insert initial-contents)
449 (setq current-minibuffer-contents initial-contents 448 (setq current-minibuffer-contents initial-contents
450 current-minibuffer-point (point)))) 449 current-minibuffer-point (point))))
451 (use-local-map (help-keymap-with-help-key 450 (use-local-map (or keymap minibuffer-local-map))
452 (or keymap minibuffer-local-map)
453 minibuffer-help-form))
454 (let ((mouse-grabbed-buffer 451 (let ((mouse-grabbed-buffer
455 (and minibuffer-smart-completion-tracking-behavior 452 (and minibuffer-smart-completion-tracking-behavior
456 (current-buffer))) 453 (current-buffer)))
457 (current-prefix-arg current-prefix-arg) 454 (current-prefix-arg current-prefix-arg)
458 ;; (help-form minibuffer-help-form) 455 (help-form minibuffer-help-form)
459 (minibuffer-history-variable (cond ((not _history_) 456 (minibuffer-history-variable (cond ((not _history_)
460 'minibuffer-history) 457 'minibuffer-history)
461 ((consp _history_) 458 ((consp _history_)
462 (car _history_)) 459 (car _history_))
463 (t 460 (t
1385 Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS 1382 Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS
1386 is a string to insert in the minibuffer before reading. 1383 is a string to insert in the minibuffer before reading.
1387 Third arg HISTORY, if non-nil, specifies a history list." 1384 Third arg HISTORY, if non-nil, specifies a history list."
1388 (eval (read-expression prompt initial-contents history))) 1385 (eval (read-expression prompt initial-contents history)))
1389 1386
1390 ;;;#### Screw this crock!!
1391 ;(defun read-no-blanks-input (prompt &optional initial-contents)
1392 ; "Read a string from the terminal, not allowing blanks.
1393 ;Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS
1394 ;is a string to insert in the minibuffer before reading."
1395 ; (let ((minibuffer-completion-table nil))
1396 ; (read-from-minibuffer prompt
1397 ; initial-contents
1398 ; minibuffer-local-ns-map
1399 ; nil)))
1400
1401 ;; The name `command-history' is already taken 1387 ;; The name `command-history' is already taken
1402 (defvar read-command-history '()) 1388 (defvar read-command-history '())
1403 1389
1404 (defun read-command (prompt) 1390 (defun read-command (prompt)
1405 "Read the name of a command and return as a symbol. 1391 "Read the name of a command and return as a symbol.
1464 (setq num (condition-case () 1450 (setq num (condition-case ()
1465 (let ((minibuffer-completion-table nil)) 1451 (let ((minibuffer-completion-table nil))
1466 (read-from-minibuffer 1452 (read-from-minibuffer
1467 prompt (if num (prin1-to-string num)) nil t 1453 prompt (if num (prin1-to-string num)) nil t
1468 t)) ;no history 1454 t)) ;no history
1469 (input-error nil)
1470 (invalid-read-syntax nil) 1455 (invalid-read-syntax nil)
1471 (end-of-file nil))) 1456 (end-of-file nil)))
1472 (or (funcall pred num) (beep))) 1457 (or (funcall pred num) (beep)))
1473 num)) 1458 num))
1474 1459
1638 history) 1623 history)
1639 "Read file name, prompting with PROMPT and completing in directory DIR. 1624 "Read file name, prompting with PROMPT and completing in directory DIR.
1640 This will prompt with a dialog box if appropriate, according to 1625 This will prompt with a dialog box if appropriate, according to
1641 `should-use-dialog-box-p'. 1626 `should-use-dialog-box-p'.
1642 Value is not expanded---you must call `expand-file-name' yourself. 1627 Value is not expanded---you must call `expand-file-name' yourself.
1643 Value is subject to interpretation by `substitute-in-file-name' however. 1628 Value is subject to interpreted by substitute-in-file-name however.
1644 Default name to DEFAULT if user enters a null string. 1629 Default name to DEFAULT if user enters a null string.
1645 (If DEFAULT is omitted, the visited file name is used, 1630 (If DEFAULT is omitted, the visited file name is used,
1646 except that if INITIAL-CONTENTS is specified, that combined with DIR is 1631 except that if INITIAL-CONTENTS is specified, that combined with DIR is
1647 used.) 1632 used.)
1648 Fourth arg MUST-MATCH non-nil means require existing file's name. 1633 Fourth arg MUST-MATCH non-nil means require existing file's name.