Mercurial > hg > xemacs-beta
comparison lisp/minibuf.el @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | 966663fcf606 |
children | 7df0dd720c89 |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
1 ;;; minibuf.el --- Minibuffer functions for XEmacs | 1 ;;; minibuf.el --- Minibuffer functions for XEmacs |
2 | 2 |
3 ;; Copyright (C) 1992, 1993, 1994, 1997 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992, 1993, 1994, 1997 Free Software Foundation, Inc. |
4 ;; Copyright (C) 1995 Tinker Systems | 4 ;; Copyright (C) 1995 Tinker Systems |
5 ;; Copyright (C) 1995, 1996 Ben Wing | 5 ;; Copyright (C) 1995, 1996 Ben Wing |
6 | 6 |
7 ;; Author: Richard Mlynarik | 7 ;; Author: Richard Mlynarik |
8 ;; Created: 2-Oct-92 | 8 ;; Created: 2-Oct-92 |
9 ;; Maintainer: XEmacs Development Team | 9 ;; Maintainer: XEmacs Development Team |
10 ;; Keywords: internal, dumped | 10 ;; Keywords: internal, dumped |
11 | 11 |
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | 20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
22 ;; General Public License for more details. | 22 ;; General Public License for more details. |
23 | 23 |
24 ;; You should have received a copy of the GNU General Public License | 24 ;; You should have received a copy of the GNU General Public License |
25 ;; along with XEmacs; see the file COPYING. If not, write to the | 25 ;; along with XEmacs; see the file COPYING. If not, write to the |
26 ;; Free Software Foundation, 59 Temple Place - Suite 330, | 26 ;; Free Software Foundation, 59 Temple Place - Suite 330, |
27 ;; Boston, MA 02111-1307, USA. | 27 ;; Boston, MA 02111-1307, USA. |
28 | 28 |
29 ;;; Synched up with: all the minibuffer history stuff is synched with | 29 ;;; Synched up with: all the minibuffer history stuff is synched with |
30 ;;; 19.30. Not sure about the rest. | 30 ;;; 19.30. Not sure about the rest. |
157 (define-key minibuffer-local-map "\M-p" 'previous-history-element) | 157 (define-key minibuffer-local-map "\M-p" 'previous-history-element) |
158 (define-key minibuffer-local-map '[next] "\M-n") | 158 (define-key minibuffer-local-map '[next] "\M-n") |
159 (define-key minibuffer-local-map '[prior] "\M-p") | 159 (define-key minibuffer-local-map '[prior] "\M-p") |
160 (define-key minibuffer-local-map "\M-r" 'previous-matching-history-element) | 160 (define-key minibuffer-local-map "\M-r" 'previous-matching-history-element) |
161 (define-key minibuffer-local-map "\M-s" 'next-matching-history-element) | 161 (define-key minibuffer-local-map "\M-s" 'next-matching-history-element) |
162 (define-key minibuffer-local-must-match-map [next] | 162 (define-key minibuffer-local-must-match-map [next] |
163 'next-complete-history-element) | 163 'next-complete-history-element) |
164 (define-key minibuffer-local-must-match-map [prior] | 164 (define-key minibuffer-local-must-match-map [prior] |
165 'previous-complete-history-element) | 165 'previous-complete-history-element) |
166 | 166 |
167 ;; This is an experiment--make up and down arrows do history. | 167 ;; This is an experiment--make up and down arrows do history. |
395 (buffer (if (eq (minibuffer-depth) 0) | 395 (buffer (if (eq (minibuffer-depth) 0) |
396 (window-buffer window) | 396 (window-buffer window) |
397 (get-buffer-create (format " *Minibuf-%d" | 397 (get-buffer-create (format " *Minibuf-%d" |
398 (minibuffer-depth))))) | 398 (minibuffer-depth))))) |
399 (frame (window-frame window)) | 399 (frame (window-frame window)) |
400 (mconfig (if (eq frame (selected-frame)) | 400 (mconfig (if (eq frame (selected-frame)) |
401 nil (current-window-configuration frame))) | 401 nil (current-window-configuration frame))) |
402 (oconfig (current-window-configuration)) | 402 (oconfig (current-window-configuration)) |
403 ;; dynamic scope sucks sucks sucks sucks sucks sucks. | 403 ;; dynamic scope sucks sucks sucks sucks sucks sucks. |
404 ;; `M-x doctor' makes history a local variable, and thus | 404 ;; `M-x doctor' makes history a local variable, and thus |
405 ;; our binding above is buffer-local and doesn't apply | 405 ;; our binding above is buffer-local and doesn't apply |
547 ;; | 547 ;; |
548 ;; This routine also offers to edit .emacs for you to get rid of this | 548 ;; This routine also offers to edit .emacs for you to get rid of this |
549 ;; complaint, like `disabled' commands do, since it's likely that non-novice | 549 ;; complaint, like `disabled' commands do, since it's likely that non-novice |
550 ;; users will be annoyed by this change, so we give them an easy way to get | 550 ;; users will be annoyed by this change, so we give them an easy way to get |
551 ;; rid of it forever. | 551 ;; rid of it forever. |
552 ;; | 552 ;; |
553 (beep t 'minibuffer-limit-exceeded) | 553 (beep t 'minibuffer-limit-exceeded) |
554 (message | 554 (message |
555 "Minibuffer already active: abort it with `^]', enable new one with `n': ") | 555 "Minibuffer already active: abort it with `^]', enable new one with `n': ") |
556 (let ((char (let ((cursor-in-echo-area t)) ; #### doesn't always work?? | 556 (let ((char (let ((cursor-in-echo-area t)) ; #### doesn't always work?? |
557 (read-char)))) | 557 (read-char)))) |
565 (save-excursion | 565 (save-excursion |
566 (set-buffer | 566 (set-buffer |
567 (find-file-noselect | 567 (find-file-noselect |
568 (substitute-in-file-name custom-file))) | 568 (substitute-in-file-name custom-file))) |
569 (goto-char (point-min)) | 569 (goto-char (point-min)) |
570 (if (re-search-forward | 570 (if (re-search-forward |
571 "^(setq minibuffer-max-depth \\([0-9]+\\|'?nil\\|'?()\\))\n" | 571 "^(setq minibuffer-max-depth \\([0-9]+\\|'?nil\\|'?()\\))\n" |
572 nil t) | 572 nil t) |
573 (delete-region (match-beginning 0 ) (match-end 0)) | 573 (delete-region (match-beginning 0 ) (match-end 0)) |
574 ;; Must have been disabled by default. | 574 ;; Must have been disabled by default. |
575 (goto-char (point-max))) | 575 (goto-char (point-max))) |
596 (message nil) | 596 (message nil) |
597 (insert m)) | 597 (insert m)) |
598 (let ((inhibit-quit t)) | 598 (let ((inhibit-quit t)) |
599 (sit-for 2) | 599 (sit-for 2) |
600 (delete-region savemax (point-max)) | 600 (delete-region savemax (point-max)) |
601 ;; If the user types a ^G while we're in sit-for, then quit-flag | 601 ;; If the user types a ^G while we're in sit-for, then quit-flag |
602 ;; gets set. In this case, we want that ^G to be interpreted | 602 ;; gets set. In this case, we want that ^G to be interpreted |
603 ;; as a normal character, and act just like typeahead. | 603 ;; as a normal character, and act just like typeahead. |
604 (if (and quit-flag (not unread-command-event)) | 604 (if (and quit-flag (not unread-command-event)) |
605 (setq unread-command-event (character-to-event (quit-char)) | 605 (setq unread-command-event (character-to-event (quit-char)) |
606 quit-flag nil))))) | 606 quit-flag nil))))) |
607 | 607 |
656 ) | 656 ) |
657 | 657 |
658 ;; 0 'none no possible completion | 658 ;; 0 'none no possible completion |
659 ;; 1 'unique was already an exact and unique completion | 659 ;; 1 'unique was already an exact and unique completion |
660 ;; 3 'exact was already an exact (but nonunique) completion | 660 ;; 3 'exact was already an exact (but nonunique) completion |
661 ;; NOT USED 'completed-exact-unique completed to an exact and completion | 661 ;; NOT USED 'completed-exact-unique completed to an exact and completion |
662 ;; 4 'completed-exact completed to an exact (but nonunique) completion | 662 ;; 4 'completed-exact completed to an exact (but nonunique) completion |
663 ;; 5 'completed some completion happened | 663 ;; 5 'completed some completion happened |
664 ;; 6 'uncompleted no completion happened | 664 ;; 6 'uncompleted no completion happened |
665 (defun minibuffer-do-completion-1 (buffer-string completion) | 665 (defun minibuffer-do-completion-1 (buffer-string completion) |
666 (cond ((not completion) | 666 (cond ((not completion) |
934 (and (not (eq char ?\ )) | 934 (and (not (eq char ?\ )) |
935 (funcall foo " ")) | 935 (funcall foo " ")) |
936 (and (not (eq char ?\-)) | 936 (and (not (eq char ?\-)) |
937 (funcall foo "-")) | 937 (funcall foo "-")) |
938 (progn | 938 (progn |
939 (if completion-auto-help | 939 (if completion-auto-help |
940 (minibuffer-completion-help) | 940 (minibuffer-completion-help) |
941 ;; New message, only in this new Lisp code | 941 ;; New message, only in this new Lisp code |
942 ;; rewritten for I18N3 snarfing | 942 ;; rewritten for I18N3 snarfing |
943 (if (eq status 'exact) | 943 (if (eq status 'exact) |
944 (temp-minibuffer-message | 944 (temp-minibuffer-message |
1314 elt))) | 1314 elt))) |
1315 ;; FSF has point-min here. | 1315 ;; FSF has point-min here. |
1316 (goto-char (point-max)))))) | 1316 (goto-char (point-max)))))) |
1317 | 1317 |
1318 (defun previous-history-element (n) | 1318 (defun previous-history-element (n) |
1319 "Inserts the previous element of the minibuffer history into the minibuffer." | 1319 "Insert the previous element of the minibuffer history into the minibuffer." |
1320 (interactive "p") | 1320 (interactive "p") |
1321 (next-history-element (- n))) | 1321 (next-history-element (- n))) |
1322 | 1322 |
1323 (defun next-complete-history-element (n) | 1323 (defun next-complete-history-element (n) |
1324 "Get next element of history which is a completion of minibuffer contents." | 1324 "Get next element of history which is a completion of minibuffer contents." |
1413 (defun read-buffer (prompt &optional default require-match) | 1413 (defun read-buffer (prompt &optional default require-match) |
1414 "Read the name of a buffer and return as a string. | 1414 "Read the name of a buffer and return as a string. |
1415 Prompts with PROMPT. Optional second arg DEFAULT is value to return if user | 1415 Prompts with PROMPT. Optional second arg DEFAULT is value to return if user |
1416 enters an empty line. If optional third arg REQUIRE-MATCH is non-nil, | 1416 enters an empty line. If optional third arg REQUIRE-MATCH is non-nil, |
1417 only existing buffer names are allowed." | 1417 only existing buffer names are allowed." |
1418 (let ((prompt (if default | 1418 (let ((prompt (if default |
1419 (format "%s(default %s) " | 1419 (format "%s(default %s) " |
1420 (gettext prompt) (if (bufferp default) | 1420 (gettext prompt) (if (bufferp default) |
1421 (buffer-name default) | 1421 (buffer-name default) |
1422 default)) | 1422 default)) |
1423 prompt)) | 1423 prompt)) |
1442 (if (bufferp result) | 1442 (if (bufferp result) |
1443 (buffer-name result) | 1443 (buffer-name result) |
1444 result))) | 1444 result))) |
1445 | 1445 |
1446 (defun read-number (prompt &optional integers-only) | 1446 (defun read-number (prompt &optional integers-only) |
1447 "Reads a number from the minibuffer." | 1447 "Read a number from the minibuffer." |
1448 (let ((pred (if integers-only 'integerp 'numberp)) | 1448 (let ((pred (if integers-only 'integerp 'numberp)) |
1449 num) | 1449 num) |
1450 (while (not (funcall pred num)) | 1450 (while (not (funcall pred num)) |
1451 (setq num (condition-case () | 1451 (setq num (condition-case () |
1452 (let ((minibuffer-completion-table nil)) | 1452 (let ((minibuffer-completion-table nil)) |
1490 (setq o (1+ o) n (1+ n)) | 1490 (setq o (1+ o) n (1+ n)) |
1491 (if (eq ch ?$) | 1491 (if (eq ch ?$) |
1492 ;; already aset by make-string initial-value | 1492 ;; already aset by make-string initial-value |
1493 (setq n (1+ n)))) | 1493 (setq n (1+ n)))) |
1494 new)))) | 1494 new)))) |
1495 | 1495 |
1496 (defun read-file-name-2 (history prompt dir default | 1496 (defun read-file-name-2 (history prompt dir default |
1497 must-match initial-contents | 1497 must-match initial-contents |
1498 completer) | 1498 completer) |
1499 (if (not dir) | 1499 (if (not dir) |
1500 (setq dir default-directory)) | 1500 (setq dir default-directory)) |
1501 (setq dir (abbreviate-file-name dir t)) | 1501 (setq dir (abbreviate-file-name dir t)) |
1585 :user-data dir-p | 1585 :user-data dir-p |
1586 :reference-buffer minibuf | 1586 :reference-buffer minibuf |
1587 :activate-callback 'read-file-name-activate-callback) | 1587 :activate-callback 'read-file-name-activate-callback) |
1588 (goto-char (point-min) completion-buf))))) | 1588 (goto-char (point-min) completion-buf))))) |
1589 | 1589 |
1590 (defun read-file-name-1 (history prompt dir default | 1590 (defun read-file-name-1 (history prompt dir default |
1591 must-match initial-contents | 1591 must-match initial-contents |
1592 completer) | 1592 completer) |
1593 (if (should-use-dialog-box-p) | 1593 (if (should-use-dialog-box-p) |
1594 ;; this calls read-file-name-2 | 1594 ;; this calls read-file-name-2 |
1595 (mouse-read-file-name-1 history prompt dir default must-match | 1595 (mouse-read-file-name-1 history prompt dir default must-match |
1658 Non-nil and non-t means also require confirmation after completion. | 1658 Non-nil and non-t means also require confirmation after completion. |
1659 Fifth arg INITIAL-CONTENTS specifies text to start with. | 1659 Fifth arg INITIAL-CONTENTS specifies text to start with. |
1660 Sixth arg HISTORY specifies the history list to use. Default is | 1660 Sixth arg HISTORY specifies the history list to use. Default is |
1661 `file-name-history'. | 1661 `file-name-history'. |
1662 DIR defaults to current buffer's directory default." | 1662 DIR defaults to current buffer's directory default." |
1663 (read-file-name-1 | 1663 (read-file-name-1 |
1664 (or history 'file-name-history) | 1664 (or history 'file-name-history) |
1665 prompt dir (or default default-directory) must-match initial-contents | 1665 prompt dir (or default default-directory) must-match initial-contents |
1666 'read-directory-name-internal)) | 1666 'read-directory-name-internal)) |
1667 | 1667 |
1668 | 1668 |
1673 string)) | 1673 string)) |
1674 ;; Not doing environment-variable completion hack | 1674 ;; Not doing environment-variable completion hack |
1675 (let* ((orig (if (equal string "") nil string)) | 1675 (let* ((orig (if (equal string "") nil string)) |
1676 (sstring (if orig (substitute-in-file-name string) string)) | 1676 (sstring (if orig (substitute-in-file-name string) string)) |
1677 (specdir (if orig (file-name-directory sstring) nil))) | 1677 (specdir (if orig (file-name-directory sstring) nil))) |
1678 (funcall completer | 1678 (funcall completer |
1679 action | 1679 action |
1680 orig | 1680 orig |
1681 sstring | 1681 sstring |
1682 specdir | 1682 specdir |
1683 (if specdir (expand-file-name specdir dir) dir) | 1683 (if specdir (expand-file-name specdir dir) dir) |
1684 (if orig (file-name-nondirectory sstring) string))) | 1684 (if orig (file-name-nondirectory sstring) string))) |
1685 ;; An odd number of trailing $'s | 1685 ;; An odd number of trailing $'s |
1686 (let* ((start (match-beginning 3)) | 1686 (let* ((start (match-beginning 3)) |
1687 (env (substring string | 1687 (env (substring string |
1688 (cond ((= start (length string)) | 1688 (cond ((= start (length string)) |
1689 ;; "...$" | 1689 ;; "...$" |
1690 start) | 1690 start) |
1691 ((= (aref string start) ?{) | 1691 ((= (aref string start) ?{) |
1692 ;; "...${..." | 1692 ;; "...${..." |
1697 (alist #'(lambda () | 1697 (alist #'(lambda () |
1698 (mapcar #'(lambda (x) | 1698 (mapcar #'(lambda (x) |
1699 (cons (substring x 0 (string-match "=" x)) | 1699 (cons (substring x 0 (string-match "=" x)) |
1700 'nil)) | 1700 'nil)) |
1701 process-environment)))) | 1701 process-environment)))) |
1702 | 1702 |
1703 (cond ((eq action 'lambda) | 1703 (cond ((eq action 'lambda) |
1704 nil) | 1704 nil) |
1705 ((eq action 't) | 1705 ((eq action 't) |
1706 ;; all completions | 1706 ;; all completions |
1707 (mapcar #'(lambda (p) | 1707 (mapcar #'(lambda (p) |
1729 (un-substitute-in-file-name (getenv env)))) | 1729 (un-substitute-in-file-name (getenv env)))) |
1730 (t nil)))))))) | 1730 (t nil)))))))) |
1731 | 1731 |
1732 | 1732 |
1733 (defun read-file-name-internal (string dir action) | 1733 (defun read-file-name-internal (string dir action) |
1734 (read-file-name-internal-1 | 1734 (read-file-name-internal-1 |
1735 string dir action | 1735 string dir action |
1736 #'(lambda (action orig string specdir dir name) | 1736 #'(lambda (action orig string specdir dir name) |
1737 (cond ((eq action 'lambda) | 1737 (cond ((eq action 'lambda) |
1738 (if (not orig) | 1738 (if (not orig) |
1739 nil | 1739 nil |
1740 (let ((sstring (condition-case nil | 1740 (let ((sstring (condition-case nil |
1741 (expand-file-name string) | 1741 (expand-file-name string) |
1742 (error nil)))) | 1742 (error nil)))) |
1743 (if (not sstring) | 1743 (if (not sstring) |
1744 ;; Some pathname syntax error in string | 1744 ;; Some pathname syntax error in string |
1745 nil | 1745 nil |
1769 ;; substitute-in-file-name did something | 1769 ;; substitute-in-file-name did something |
1770 tem | 1770 tem |
1771 val))))))))) | 1771 val))))))))) |
1772 | 1772 |
1773 (defun read-directory-name-internal (string dir action) | 1773 (defun read-directory-name-internal (string dir action) |
1774 (read-file-name-internal-1 | 1774 (read-file-name-internal-1 |
1775 string dir action | 1775 string dir action |
1776 #'(lambda (action orig string specdir dir name) | 1776 #'(lambda (action orig string specdir dir name) |
1777 (let* ((dirs #'(lambda (fn) | 1777 (let* ((dirs #'(lambda (fn) |
1778 (let ((l (if (equal name "") | 1778 (let ((l (if (equal name "") |
1779 (directory-files | 1779 (directory-files |
1782 "" | 1782 "" |
1783 nil | 1783 nil |
1784 'directories) | 1784 'directories) |
1785 (directory-files | 1785 (directory-files |
1786 dir | 1786 dir |
1787 nil | 1787 nil |
1788 (concat "\\`" (regexp-quote name)) | 1788 (concat "\\`" (regexp-quote name)) |
1789 nil | 1789 nil |
1790 'directories)))) | 1790 'directories)))) |
1791 (mapcar fn | 1791 (mapcar fn |
1792 (cond ((eq system-type 'vax-vms) | 1792 (cond ((eq system-type 'vax-vms) |
1800 nil | 1800 nil |
1801 (file-directory-p string))) | 1801 (file-directory-p string))) |
1802 ((eq action 't) | 1802 ((eq action 't) |
1803 ;; all completions | 1803 ;; all completions |
1804 (funcall dirs #'(lambda (n) | 1804 (funcall dirs #'(lambda (n) |
1805 (un-substitute-in-file-name | 1805 (un-substitute-in-file-name |
1806 (file-name-as-directory n))))) | 1806 (file-name-as-directory n))))) |
1807 (t | 1807 (t |
1808 ;; complete | 1808 ;; complete |
1809 (let ((val (try-completion | 1809 (let ((val (try-completion |
1810 name | 1810 name |
1822 tem | 1822 tem |
1823 val)))))))))) | 1823 val)))))))))) |
1824 | 1824 |
1825 (defun append-expand-filename (file-string string) | 1825 (defun append-expand-filename (file-string string) |
1826 "Append STRING to FILE-STRING differently depending on whether STRING | 1826 "Append STRING to FILE-STRING differently depending on whether STRING |
1827 is a username (~string), an environment variable ($string), | 1827 is a username (~string), an environment variable ($string), |
1828 or a filename (/string). The resultant string is returned with the | 1828 or a filename (/string). The resultant string is returned with the |
1829 environment variable or username expanded and resolved to indicate | 1829 environment variable or username expanded and resolved to indicate |
1830 whether it is a file(/result) or a directory (/result/)." | 1830 whether it is a file(/result) or a directory (/result/)." |
1831 (let ((file | 1831 (let ((file |
1832 (cond ((string-match "\\([~$]\\)\\([^~$/]*\\)$" file-string) | 1832 (cond ((string-match "\\([~$]\\)\\([^~$/]*\\)$" file-string) |
1833 (cond ((string= (substring file-string | 1833 (cond ((string= (substring file-string |
1834 (match-beginning 1) | 1834 (match-beginning 1) |
1835 (match-end 1)) "~") | 1835 (match-end 1)) "~") |
1836 (concat (substring file-string 0 (match-end 1)) | 1836 (concat (substring file-string 0 (match-end 1)) |
1837 string)) | 1837 string)) |
1838 (t (substitute-in-file-name | 1838 (t (substitute-in-file-name |
1839 (concat (substring file-string 0 (match-end 1)) | 1839 (concat (substring file-string 0 (match-end 1)) |
1840 string))))) | 1840 string))))) |
1841 (t (concat (file-name-directory | 1841 (t (concat (file-name-directory |
1842 (substitute-in-file-name file-string)) string)))) | 1842 (substitute-in-file-name file-string)) string)))) |
1843 result) | 1843 result) |
1844 | 1844 |
1845 (cond ((stringp (setq result (and (file-exists-p (expand-file-name file)) | 1845 (cond ((stringp (setq result (and (file-exists-p (expand-file-name file)) |
1846 (read-file-name-internal | 1846 (read-file-name-internal |
1847 (condition-case nil | 1847 (condition-case nil |
1848 (expand-file-name file) | 1848 (expand-file-name file) |
1849 (error file)) | 1849 (error file)) |
1850 "" nil)))) | 1850 "" nil)))) |
1851 result) | 1851 result) |
1852 (t file)))) | 1852 (t file)))) |
1853 | 1853 |
1854 (defun mouse-file-display-completion-list (window dir minibuf user-data) | 1854 (defun mouse-file-display-completion-list (window dir minibuf user-data) |
1855 (let ((standard-output (window-buffer window))) | 1855 (let ((standard-output (window-buffer window))) |
1856 (condition-case nil | 1856 (condition-case nil |
1857 (display-completion-list | 1857 (display-completion-list |
1858 (directory-files dir nil nil nil t) | 1858 (directory-files dir nil nil nil t) |
1859 :window-width (* 2 (window-width window)) | 1859 :window-width (* 2 (window-width window)) |
1860 :activate-callback | 1860 :activate-callback |
1861 'mouse-read-file-name-activate-callback | 1861 'mouse-read-file-name-activate-callback |
1862 :user-data user-data | 1862 :user-data user-data |
1900 (reset-buffer dirbuff) | 1900 (reset-buffer dirbuff) |
1901 (mouse-directory-display-completion-list dirwin full minibuf | 1901 (mouse-directory-display-completion-list dirwin full minibuf |
1902 user-data))))) | 1902 user-data))))) |
1903 | 1903 |
1904 ;; this is rather cheesified but gets the job done. | 1904 ;; this is rather cheesified but gets the job done. |
1905 (defun mouse-read-file-name-1 (history prompt dir default | 1905 (defun mouse-read-file-name-1 (history prompt dir default |
1906 must-match initial-contents | 1906 must-match initial-contents |
1907 completer) | 1907 completer) |
1908 (let* ((file-p (eq 'read-file-name-internal completer)) | 1908 (let* ((file-p (eq 'read-file-name-internal completer)) |
1909 (filebuf (get-buffer-create "*Completions*")) | 1909 (filebuf (get-buffer-create "*Completions*")) |
1910 (dirbuff (and file-p (generate-new-buffer " *mouse-read-file*"))) | 1910 (dirbuff (and file-p (generate-new-buffer " *mouse-read-file*"))) |
1937 (when dir | 1937 (when dir |
1938 (setq default-directory dir)) | 1938 (setq default-directory dir)) |
1939 (when (featurep 'scrollbar) | 1939 (when (featurep 'scrollbar) |
1940 (set-specifier scrollbar-width 0 butbuff)) | 1940 (set-specifier scrollbar-width 0 butbuff)) |
1941 (insert " ") | 1941 (insert " ") |
1942 (insert-gui-button (make-gui-button "OK" | 1942 (insert-gui-button (make-gui-button "OK" |
1943 (lambda (foo) | 1943 (lambda (foo) |
1944 (exit-minibuffer)))) | 1944 (exit-minibuffer)))) |
1945 (insert " ") | 1945 (insert " ") |
1946 (insert-gui-button (make-gui-button "Cancel" | 1946 (insert-gui-button (make-gui-button "Cancel" |
1947 (lambda (foo) | 1947 (lambda (foo) |
1980 (setq truncate-lines t))))) | 1980 (setq truncate-lines t))))) |
1981 (unwind-protect | 1981 (unwind-protect |
1982 (progn | 1982 (progn |
1983 (add-hook 'minibuffer-setup-hook rfhookfun) | 1983 (add-hook 'minibuffer-setup-hook rfhookfun) |
1984 (add-hook 'completion-setup-hook rfcshookfun) | 1984 (add-hook 'completion-setup-hook rfcshookfun) |
1985 (read-file-name-2 history prompt dir default | 1985 (read-file-name-2 history prompt dir default |
1986 must-match initial-contents | 1986 must-match initial-contents |
1987 completer)) | 1987 completer)) |
1988 (remove-hook 'minibuffer-setup-hook rfhookfun) | 1988 (remove-hook 'minibuffer-setup-hook rfhookfun) |
1989 (remove-hook 'completion-setup-hook rfcshookfun)))) | 1989 (remove-hook 'completion-setup-hook rfcshookfun)))) |
1990 (delete-frame frame) | 1990 (delete-frame frame) |
2001 ;; obsolete, and `read-color-completion-table' conses (mapcar #'list | 2001 ;; obsolete, and `read-color-completion-table' conses (mapcar #'list |
2002 ;; (color-list)), optionally caching the results. | 2002 ;; (color-list)), optionally caching the results. |
2003 | 2003 |
2004 ;; Ben wanted all of the possibilities from the `configure' script used | 2004 ;; Ben wanted all of the possibilities from the `configure' script used |
2005 ;; here, but I think this is way too many. I already trimmed the R4 variants | 2005 ;; here, but I think this is way too many. I already trimmed the R4 variants |
2006 ;; and a few obvious losers from the list. --Stig | 2006 ;; and a few obvious losers from the list. --Stig |
2007 (defvar x-library-search-path '("/usr/X11R6/lib/X11/" | 2007 (defvar x-library-search-path '("/usr/X11R6/lib/X11/" |
2008 "/usr/X11R5/lib/X11/" | 2008 "/usr/X11R5/lib/X11/" |
2009 "/usr/lib/X11R6/X11/" | 2009 "/usr/lib/X11R6/X11/" |
2010 "/usr/lib/X11R5/X11/" | 2010 "/usr/lib/X11R5/X11/" |
2011 "/usr/local/X11R6/lib/X11/" | 2011 "/usr/local/X11R6/lib/X11/" |