Mercurial > emacs
comparison lisp/recentf.el @ 83386:db4e74787e6f
Merged from miles@gnu.org--gnu-2005 (patch 133-141, 596-609)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-596
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-597
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-598
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-599
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-600
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-601
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-602
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-603
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-604
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-605
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-606
Remove lisp/toolbar directory
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-607
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-608
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-609
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-133
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-134
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-135
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-136
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-137
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-138
Update from CVS: texi/gnus.texi (RSS): Fix key description.
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-139
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-140
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-141
Update from CVS: texi/gnus.texi (Document Server Internals): Addition.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-426
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Wed, 19 Oct 2005 14:06:17 +0000 |
parents | 08b4dd6a6e87 3ee176d1ff23 |
children | 1955a4462bf9 |
comparison
equal
deleted
inserted
replaced
83385:1cd4072747c6 | 83386:db4e74787e6f |
---|---|
983 (list (vector (cdr filter) | 983 (list (vector (cdr filter) |
984 '(recentf-filter-changer-goto-next) | 984 '(recentf-filter-changer-goto-next) |
985 t))))) | 985 t))))) |
986 l)) | 986 l)) |
987 | 987 |
988 ;;; Common dialog stuff | |
989 ;; | |
990 (defun recentf-cancel-dialog (&rest ignore) | |
991 "Cancel the current dialog. | |
992 IGNORE arguments." | |
993 (interactive) | |
994 (kill-buffer (current-buffer)) | |
995 (message "Dialog canceled")) | |
996 | |
997 (defun recentf-dialog-goto-first (widget-type) | |
998 "Move the cursor to the first WIDGET-TYPE in current dialog. | |
999 Go to the beginning of buffer if not found." | |
1000 (goto-char (point-min)) | |
1001 (condition-case nil | |
1002 (let (done) | |
1003 (widget-move 1) | |
1004 (while (not done) | |
1005 (if (eq widget-type (widget-type (widget-at (point)))) | |
1006 (setq done t) | |
1007 (widget-move 1)))) | |
1008 (goto-char (point-min)))) | |
1009 | |
1010 (defvar recentf-dialog-mode-map | |
1011 (let ((km (copy-keymap recentf--shortcuts-keymap))) | |
1012 (set-keymap-parent km widget-keymap) | |
1013 (define-key km "q" 'recentf-cancel-dialog) | |
1014 (define-key km [down-mouse-1] 'widget-button-click) | |
1015 km) | |
1016 "Keymap used in recentf dialogs.") | |
1017 | |
1018 (define-derived-mode recentf-dialog-mode nil "recentf-dialog" | |
1019 "Major mode of recentf dialogs. | |
1020 | |
1021 \\{recentf-dialog-mode-map}" | |
1022 :syntax-table nil | |
1023 :abbrev-table nil | |
1024 (setq truncate-lines t)) | |
1025 | |
1026 (defmacro recentf-dialog (name &rest forms) | |
1027 "Show a dialog buffer with NAME, setup with FORMS." | |
1028 (declare (indent 1) (debug t)) | |
1029 `(with-current-buffer (get-buffer-create ,name) | |
1030 ;; Cleanup buffer | |
1031 (let ((inhibit-read-only t) | |
1032 (ol (overlay-lists))) | |
1033 (mapc 'delete-overlay (car ol)) | |
1034 (mapc 'delete-overlay (cdr ol)) | |
1035 (erase-buffer)) | |
1036 (recentf-dialog-mode) | |
1037 ,@forms | |
1038 (widget-setup) | |
1039 (switch-to-buffer (current-buffer)))) | |
1040 | |
1041 ;;; Hooks | 988 ;;; Hooks |
1042 ;; | 989 ;; |
1043 (defun recentf-track-opened-file () | 990 (defun recentf-track-opened-file () |
1044 "Insert the name of the file just opened or written into the recent list." | 991 "Insert the name of the file just opened or written into the recent list." |
1045 (and buffer-file-name | 992 (and buffer-file-name |
1084 (memq 'recentf-update-menu menu-bar-update-hook)) | 1031 (memq 'recentf-update-menu menu-bar-update-hook)) |
1085 | 1032 |
1086 ;;; Commands | 1033 ;;; Commands |
1087 ;; | 1034 ;; |
1088 | 1035 |
1036 ;;; Common dialog stuff | |
1037 ;; | |
1038 (defun recentf-cancel-dialog (&rest ignore) | |
1039 "Cancel the current dialog. | |
1040 IGNORE arguments." | |
1041 (interactive) | |
1042 (kill-buffer (current-buffer)) | |
1043 (message "Dialog canceled")) | |
1044 | |
1045 (defun recentf-dialog-goto-first (widget-type) | |
1046 "Move the cursor to the first WIDGET-TYPE in current dialog. | |
1047 Go to the beginning of buffer if not found." | |
1048 (goto-char (point-min)) | |
1049 (condition-case nil | |
1050 (let (done) | |
1051 (widget-move 1) | |
1052 (while (not done) | |
1053 (if (eq widget-type (widget-type (widget-at (point)))) | |
1054 (setq done t) | |
1055 (widget-move 1)))) | |
1056 (goto-char (point-min)))) | |
1057 | |
1058 (defvar recentf-dialog-mode-map | |
1059 (let ((km (copy-keymap recentf--shortcuts-keymap))) | |
1060 (set-keymap-parent km widget-keymap) | |
1061 (define-key km "q" 'recentf-cancel-dialog) | |
1062 (define-key km [follow-link] "\C-m") | |
1063 km) | |
1064 "Keymap used in recentf dialogs.") | |
1065 | |
1066 (define-derived-mode recentf-dialog-mode nil "recentf-dialog" | |
1067 "Major mode of recentf dialogs. | |
1068 | |
1069 \\{recentf-dialog-mode-map}" | |
1070 :syntax-table nil | |
1071 :abbrev-table nil | |
1072 (setq truncate-lines t)) | |
1073 | |
1074 (defmacro recentf-dialog (name &rest forms) | |
1075 "Show a dialog buffer with NAME, setup with FORMS." | |
1076 (declare (indent 1) (debug t)) | |
1077 `(with-current-buffer (get-buffer-create ,name) | |
1078 ;; Cleanup buffer | |
1079 (let ((inhibit-read-only t) | |
1080 (ol (overlay-lists))) | |
1081 (mapc 'delete-overlay (car ol)) | |
1082 (mapc 'delete-overlay (cdr ol)) | |
1083 (erase-buffer)) | |
1084 (recentf-dialog-mode) | |
1085 ,@forms | |
1086 (widget-setup) | |
1087 (switch-to-buffer (current-buffer)))) | |
1088 | |
1089 ;;; Edit list dialog | 1089 ;;; Edit list dialog |
1090 ;; | 1090 ;; |
1091 (defvar recentf-edit-list nil) | 1091 (defvar recentf-edit-list nil) |
1092 | 1092 |
1093 (defun recentf-edit-list-select (widget &rest ignore) | 1093 (defun recentf-edit-list-select (widget &rest ignore) |
1138 (widget-create | 1138 (widget-create |
1139 'push-button | 1139 'push-button |
1140 :notify 'recentf-cancel-dialog | 1140 :notify 'recentf-cancel-dialog |
1141 "Cancel") | 1141 "Cancel") |
1142 (recentf-dialog-goto-first 'checkbox))) | 1142 (recentf-dialog-goto-first 'checkbox))) |
1143 | 1143 |
1144 ;;; Open file dialog | 1144 ;;; Open file dialog |
1145 ;; | 1145 ;; |
1146 (defun recentf-open-files-action (widget &rest ignore) | 1146 (defun recentf-open-files-action (widget &rest ignore) |
1147 "Open the file stored in WIDGET's value when notified. | 1147 "Open the file stored in WIDGET's value when notified. |
1148 IGNORE other arguments." | 1148 IGNORE other arguments." |
1250 (unless file (error "Not that many recent files")) | 1250 (unless file (error "Not that many recent files")) |
1251 ;; Close the open files dialog. | 1251 ;; Close the open files dialog. |
1252 (when recentf--files-with-key | 1252 (when recentf--files-with-key |
1253 (kill-buffer (current-buffer))) | 1253 (kill-buffer (current-buffer))) |
1254 (funcall recentf-menu-action file))) | 1254 (funcall recentf-menu-action file))) |
1255 | 1255 |
1256 ;;; Save/load/cleanup the recent list | 1256 ;;; Save/load/cleanup the recent list |
1257 ;; | 1257 ;; |
1258 (defconst recentf-save-file-header | 1258 (defconst recentf-save-file-header |
1259 ";;; Automatically generated by `recentf' on %s.\n" | 1259 ";;; Automatically generated by `recentf' on %s.\n" |
1260 "Header to be written into the `recentf-save-file'.") | 1260 "Header to be written into the `recentf-save-file'.") |
1314 (push f newlist) | 1314 (push f newlist) |
1315 (setq n (1+ n)) | 1315 (setq n (1+ n)) |
1316 (message "File %s removed from the recentf list" f))) | 1316 (message "File %s removed from the recentf list" f))) |
1317 (message "Cleaning up the recentf list...done (%d removed)" n) | 1317 (message "Cleaning up the recentf list...done (%d removed)" n) |
1318 (setq recentf-list (nreverse newlist)))) | 1318 (setq recentf-list (nreverse newlist)))) |
1319 | 1319 |
1320 ;;; The minor mode | |
1321 ;; | |
1320 (defvar recentf-mode-map (make-sparse-keymap) | 1322 (defvar recentf-mode-map (make-sparse-keymap) |
1321 "Keymap to use in recentf mode.") | 1323 "Keymap to use in recentf mode.") |
1322 | 1324 |
1323 ;;;###autoload | 1325 ;;;###autoload |
1324 (define-minor-mode recentf-mode | 1326 (define-minor-mode recentf-mode |