Mercurial > emacs
comparison lisp/recentf.el @ 32292:11bee5bae414
Doc fixes.
author | Dave Love <fx@gnu.org> |
---|---|
date | Sun, 08 Oct 2000 16:34:14 +0000 |
parents | 293a86f4d8aa |
children | 0e626f0c2b8a |
comparison
equal
deleted
inserted
replaced
32291:ad4a568e556a | 32292:11bee5bae414 |
---|---|
33 ;; the source code for details). To install and use, put the file on | 33 ;; the source code for details). To install and use, put the file on |
34 ;; your Emacs-Lisp load path and add the following into your ~/.emacs | 34 ;; your Emacs-Lisp load path and add the following into your ~/.emacs |
35 ;; startup file: | 35 ;; startup file: |
36 ;; | 36 ;; |
37 ;; (require 'recentf) | 37 ;; (require 'recentf) |
38 ;; (recentf-mode 1) | 38 ;; (recentf-mode 1) |
39 | 39 |
40 ;;; Code: | 40 ;;; Code: |
41 | 41 |
42 (require 'easymenu) | 42 (require 'easymenu) |
43 (require 'wid-edit) | 43 (require 'wid-edit) |
61 ;; and `recentf-menu-title' values. | 61 ;; and `recentf-menu-title' values. |
62 (defun recentf-menu-customization-changed (sym val) | 62 (defun recentf-menu-customization-changed (sym val) |
63 "Function called when menu customization has changed. | 63 "Function called when menu customization has changed. |
64 It removes the recentf menu and forces its complete redrawing." | 64 It removes the recentf menu and forces its complete redrawing." |
65 (when recentf-initialized-p | 65 (when recentf-initialized-p |
66 (easy-menu-remove-item nil | 66 (easy-menu-remove-item nil |
67 (symbol-value 'recentf-menu-path) | 67 (symbol-value 'recentf-menu-path) |
68 (symbol-value 'recentf-menu-title)) | 68 (symbol-value 'recentf-menu-title)) |
69 (setq recentf-update-menu-p t)) | 69 (setq recentf-update-menu-p t)) |
70 (custom-set-default sym val)) | 70 (custom-set-default sym val)) |
71 | 71 |
118 | 118 |
119 (defcustom recentf-menu-action 'recentf-find-file | 119 (defcustom recentf-menu-action 'recentf-find-file |
120 "*Function to invoke with a filename item of the recentf menu. | 120 "*Function to invoke with a filename item of the recentf menu. |
121 The default action `recentf-find-file' calls `find-file' to edit an | 121 The default action `recentf-find-file' calls `find-file' to edit an |
122 existing file. If the file does not exist or is not readable, it is | 122 existing file. If the file does not exist or is not readable, it is |
123 not edited and its name is removed from `recentf-list'. You can use | 123 not edited and its name is removed from `recentf-list'. You can use |
124 `find-file' instead to open non-existing files and keep them in the | 124 `find-file' instead to open non-existing files and keep them in the |
125 list of recently opened files." | 125 list of recently opened files." |
126 :group 'recentf | 126 :group 'recentf |
127 :type 'function | 127 :type 'function |
128 :set 'recentf-menu-customization-changed) | 128 :set 'recentf-menu-customization-changed) |
252 | 252 |
253 A menu element is a pair (MENU-ITEM . MENU-VALUE) where: | 253 A menu element is a pair (MENU-ITEM . MENU-VALUE) where: |
254 | 254 |
255 - - MENU-ITEM is the menu item string displayed. | 255 - - MENU-ITEM is the menu item string displayed. |
256 - - MENU-VALUE is the path used to open the file when the | 256 - - MENU-VALUE is the path used to open the file when the |
257 corresponding MENU-ITEM is selected. Or it is | 257 corresponding MENU-ITEM is selected. Or it is |
258 a pair (SUB-MENU-TITLE . MENU-ELEMENTS) where | 258 a pair (SUB-MENU-TITLE . MENU-ELEMENTS) where |
259 SUB-MENU-TITLE is a sub-menu title and | 259 SUB-MENU-TITLE is a sub-menu title and |
260 MENU-ELEMENTS is the list of menu elements in | 260 MENU-ELEMENTS is the list of menu elements in |
261 the sub-menu." | 261 the sub-menu." |
262 (cons menu-item menu-value)) | 262 (cons menu-item menu-value)) |
280 (defun recentf-sub-menu-element-p (e) | 280 (defun recentf-sub-menu-element-p (e) |
281 "Return non-nil if menu-element E defines a sub-menu." | 281 "Return non-nil if menu-element E defines a sub-menu." |
282 (consp (recentf-menu-element-value e))) | 282 (consp (recentf-menu-element-value e))) |
283 | 283 |
284 (defun recentf-make-default-menu-element (file-path) | 284 (defun recentf-make-default-menu-element (file-path) |
285 "Make a new default menu element (MENU-ITEM . MENU-VALUE) for the | 285 "Make a new default menu element (MENU-ITEM . MENU-VALUE). |
286 given recent file path FILE-PATH. MENU-ITEM and MENU-VALUE are set to | 286 Do so for the given recent file path FILE-PATH. MENU-ITEM and |
287 FILE-PATH. See also `recentf-make-menu-element'." | 287 MENU-VALUE are set to FILE-PATH. See also |
288 `recentf-make-menu-element'." | |
288 (recentf-make-menu-element file-path file-path)) | 289 (recentf-make-menu-element file-path file-path)) |
289 | 290 |
290 (defun recentf-menu-elements (n) | 291 (defun recentf-menu-elements (n) |
291 "Return a list of the first N default menu elements from | 292 "Return a list of the first N default menu elements from `recentf-list'. |
292 `recentf-list'. See also `recentf-make-default-menu-element'." | 293 See also `recentf-make-default-menu-element'." |
293 (mapcar 'recentf-make-default-menu-element | 294 (mapcar 'recentf-make-default-menu-element |
294 (recentf-elements n))) | 295 (recentf-elements n))) |
295 | 296 |
296 (defun recentf-apply-menu-filter (filter l) | 297 (defun recentf-apply-menu-filter (filter l) |
297 "Convenient funtion to apply the function FILTER to the list of | 298 "Apply function FILTER to the list of menu-elements L. |
298 menu-elements L. It takes care of sub-menu elements in L and | 299 It takes care of sub-menu elements in L and recursively apply FILTER |
299 recursively apply FILTER to them. It is guarantee than FILTER receives | 300 to them. It is guarantee than FILTER receives only a list of single |
300 only a list of single menu-elements (no sub-menu)." | 301 menu-elements (no sub-menu)." |
301 (if (and (functionp filter) l) | 302 (if (and (functionp filter) l) |
302 (let ((case-fold-search recentf-case-fold-search) | 303 (let ((case-fold-search recentf-case-fold-search) |
303 menu-element sub-menu-elements single-elements) | 304 menu-element sub-menu-elements single-elements) |
304 ;; split L in two sub-listes: | 305 ;; split L in two sub-listes: |
305 ;; one of sub-menus elements and | 306 ;; one of sub-menus elements and |
415 (string-lessp | 416 (string-lessp |
416 (file-name-nondirectory (recentf-menu-element-value e2)) | 417 (file-name-nondirectory (recentf-menu-element-value e2)) |
417 (file-name-nondirectory (recentf-menu-element-value e1))))))) | 418 (file-name-nondirectory (recentf-menu-element-value e1))))))) |
418 | 419 |
419 (defun recentf-directory-compare (p1 p2) | 420 (defun recentf-directory-compare (p1 p2) |
420 "Compare directories then filenames in pathes P1 and P2 and return | 421 "Compare directories then filenames in paths P1 and P2. |
421 non-nil if P1 is less than P2." | 422 Return non-nil if P1 is less than P2." |
422 (let ((d1 (file-name-directory p1)) | 423 (let ((d1 (file-name-directory p1)) |
423 (f1 (file-name-nondirectory p1)) | 424 (f1 (file-name-nondirectory p1)) |
424 (d2 (file-name-directory p2)) | 425 (d2 (file-name-directory p2)) |
425 (f2 (file-name-nondirectory p2))) | 426 (f2 (file-name-nondirectory p2))) |
426 (if (string= d1 d2) | 427 (if (string= d1 d2) |
445 (recentf-directory-compare (recentf-menu-element-value e2) | 446 (recentf-directory-compare (recentf-menu-element-value e2) |
446 (recentf-menu-element-value e1)))))) | 447 (recentf-menu-element-value e1)))))) |
447 | 448 |
448 (defun recentf-show-basenames (l) | 449 (defun recentf-show-basenames (l) |
449 "Filter the list of menu elements L to show only file names (no directories) | 450 "Filter the list of menu elements L to show only file names (no directories) |
450 in the menu. When file names are duplicated their directory component is added." | 451 in the menu. When file names are duplicated their directory component is added." |
451 (let ((names (mapcar (function | 452 (let ((names (mapcar (function |
452 (lambda (item) | 453 (lambda (item) |
453 (file-name-nondirectory | 454 (file-name-nondirectory |
454 (recentf-menu-element-value item)))) | 455 (recentf-menu-element-value item)))) |
455 l)) | 456 l)) |
474 filtered-list)) | 475 filtered-list)) |
475 (setq filtered-items (cons item filtered-items))) | 476 (setq filtered-items (cons item filtered-items))) |
476 (nreverse filtered-list))) | 477 (nreverse filtered-list))) |
477 | 478 |
478 (defun recentf-show-basenames-ascending (l) | 479 (defun recentf-show-basenames-ascending (l) |
479 "Filter the list of menu elements L to show only file names in the menu, | 480 "Filter the list of menu elements L. |
480 sorted in ascending order. This filter combines the `recentf-sort-basenames-ascending' | 481 Show only file names in the menu, sorted in ascending order. This |
481 and `recentf-show-basenames' filters." | 482 filter combines the `recentf-sort-basenames-ascending' and |
483 `recentf-show-basenames' filters." | |
482 (recentf-show-basenames (recentf-sort-basenames-ascending l))) | 484 (recentf-show-basenames (recentf-sort-basenames-ascending l))) |
483 | 485 |
484 (defun recentf-show-basenames-descending (l) | 486 (defun recentf-show-basenames-descending (l) |
485 "Filter the list of menu elements L to show only file names in the menu, | 487 "Filter the list of menu elements L. |
486 sorted in descending order. This filter combines the `recentf-sort-basenames-descending' | 488 Show only file names in the menu, sorted in descending order. This |
487 and `recentf-show-basenames' filters." | 489 filter combines the `recentf-sort-basenames-descending' and |
490 `recentf-show-basenames' filters." | |
488 (recentf-show-basenames (recentf-sort-basenames-descending l))) | 491 (recentf-show-basenames (recentf-sort-basenames-descending l))) |
489 | 492 |
490 (defun recentf-relative-filter (l) | 493 (defun recentf-relative-filter (l) |
491 "Filter the list of `recentf-menu-elements' L to show filenames | 494 "Filter the list of `recentf-menu-elements' L. |
492 relative to `default-directory'." | 495 Show filenames relative to `default-directory'." |
493 (setq recentf-update-menu-p t) ; force menu update | 496 (setq recentf-update-menu-p t) ; force menu update |
494 (mapcar (function | 497 (mapcar (function |
495 (lambda (menu-element) | 498 (lambda (menu-element) |
496 (let* ((ful-path (recentf-menu-element-value menu-element)) | 499 (let* ((ful-path (recentf-menu-element-value menu-element)) |
497 (rel-path (file-relative-name ful-path))) | 500 (rel-path (file-relative-name ful-path))) |
505 ("Elisp files (%d)" ".\\.el$") | 508 ("Elisp files (%d)" ".\\.el$") |
506 ("Java files (%d)" ".\\.java$") | 509 ("Java files (%d)" ".\\.java$") |
507 ("C/C++ files (%d)" "c\\(pp\\)?$") | 510 ("C/C++ files (%d)" "c\\(pp\\)?$") |
508 ) | 511 ) |
509 "*List of rules used by `recentf-arrange-by-rule' to build sub-menus. | 512 "*List of rules used by `recentf-arrange-by-rule' to build sub-menus. |
510 A rule is a pair (SUB-MENU-TITLE . MATCHER). SUB-MENU-TITLE is the | 513 A rule is a pair (SUB-MENU-TITLE . MATCHER). SUB-MENU-TITLE is the |
511 displayed title of the sub-menu where a '%d' `format' pattern is | 514 displayed title of the sub-menu where a '%d' `format' pattern is |
512 replaced by the number of items in the sub-menu. MATCHER is a regexp | 515 replaced by the number of items in the sub-menu. MATCHER is a regexp |
513 or a list of regexps. Items matching one of the regular expressions in | 516 or a list of regexps. Items matching one of the regular expressions in |
514 MATCHER are added to the corresponding sub-menu." | 517 MATCHER are added to the corresponding sub-menu." |
515 :group 'recentf-filters | 518 :group 'recentf-filters |
516 :type '(repeat (cons string (repeat regexp))) | 519 :type '(repeat (cons string (repeat regexp))) |
517 :set 'recentf-menu-customization-changed) | 520 :set 'recentf-menu-customization-changed) |
518 | 521 |
519 (defcustom recentf-arrange-by-rule-others "Other files (%d)" | 522 (defcustom recentf-arrange-by-rule-others "Other files (%d)" |
520 "*Title of the `recentf-arrange-by-rule' sub-menu where items that | 523 "*Title of the `recentf-arrange-by-rule' sub-menu. |
521 don't match any `recentf-arrange-rules' are displayed. If nil | 524 This is for the menu where items that don't match any |
522 these items are displayed in the main recent files menu. A '%d' | 525 `recentf-arrange-rules' are displayed. If nil these items are |
523 `format' pattern in the title is replaced by the number of items in | 526 displayed in the main recent files menu. A '%d' `format' pattern in |
524 the sub-menu." | 527 the title is replaced by the number of items in the sub-menu." |
525 :group 'recentf-filters | 528 :group 'recentf-filters |
526 :type '(choice (const :tag "Main menu" nil) | 529 :type '(choice (const :tag "Main menu" nil) |
527 (string :tag "Title")) | 530 (string :tag "Title")) |
528 :set 'recentf-menu-customization-changed) | 531 :set 'recentf-menu-customization-changed) |
529 | 532 |
537 :type 'number | 540 :type 'number |
538 :set 'recentf-menu-customization-changed) | 541 :set 'recentf-menu-customization-changed) |
539 | 542 |
540 (defcustom recentf-arrange-by-rule-subfilter nil | 543 (defcustom recentf-arrange-by-rule-subfilter nil |
541 "*Function used by `recentf-arrange-by-rule' to filter sub-menu elements. | 544 "*Function used by `recentf-arrange-by-rule' to filter sub-menu elements. |
542 Nil means no filter. See also `recentf-menu-filter'. You can't use | 545 Nil means no filter. See also `recentf-menu-filter'. You can't use |
543 `recentf-arrange-by-rule' itself here!" | 546 `recentf-arrange-by-rule' itself here!" |
544 :group 'recentf-filters | 547 :group 'recentf-filters |
545 :type 'function | 548 :type 'function |
546 :set (lambda (sym val) | 549 :set (lambda (sym val) |
547 (if (eq val 'recentf-arrange-by-rule) | 550 (if (eq val 'recentf-arrange-by-rule) |
557 (not (string-match (car matcher) file-path))) | 560 (not (string-match (car matcher) file-path))) |
558 (setq matcher (cdr matcher))) | 561 (setq matcher (cdr matcher))) |
559 matcher)) | 562 matcher)) |
560 | 563 |
561 (defun recentf-arrange-by-rule (l) | 564 (defun recentf-arrange-by-rule (l) |
562 "Filter the list of menu-elements L to arrange them in sub-menus | 565 "Filter the list of menu-elements L. |
563 following rules in `recentf-arrange-rules'." | 566 Arrange them in sub-menus following rules in `recentf-arrange-rules'." |
564 (let ((sub-menus-number (length recentf-arrange-rules))) | 567 (let ((sub-menus-number (length recentf-arrange-rules))) |
565 (if (> sub-menus-number 0) | 568 (if (> sub-menus-number 0) |
566 (let ((sub-menus (apply 'vector | 569 (let ((sub-menus (apply 'vector |
567 (mapcar (function | 570 (mapcar (function |
568 (lambda (pair) | 571 (lambda (pair) |
653 ;; It is important to preserve auto-mode-alist order | 656 ;; It is important to preserve auto-mode-alist order |
654 ;; to ensure the right file <-> mode association | 657 ;; to ensure the right file <-> mode association |
655 (nreverse rules))) | 658 (nreverse rules))) |
656 | 659 |
657 (defun recentf-arrange-by-mode (l) | 660 (defun recentf-arrange-by-mode (l) |
658 "Filter the list of menu-elements L to build sub-menus for each | 661 "Filter the list of menu-elements L to build sub-menus for each major mode." |
659 major mode." | |
660 (let ((recentf-arrange-rules (recentf-build-mode-rules)) | 662 (let ((recentf-arrange-rules (recentf-build-mode-rules)) |
661 (recentf-arrange-by-rule-others "others (%d)")) | 663 (recentf-arrange-by-rule-others "others (%d)")) |
662 (recentf-arrange-by-rule l))) | 664 (recentf-arrange-by-rule l))) |
663 | 665 |
664 (defun recentf-build-dir-rules (l) | 666 (defun recentf-build-dir-rules (l) |
665 "Convert directories in the list of menu-elements L to rules in | 667 "Convert directories in menu-elements L to rules in `recentf-arrange-rules' format." |
666 `recentf-arrange-rules' format." | |
667 (let (dirs) | 668 (let (dirs) |
668 (mapcar (function | 669 (mapcar (function |
669 (lambda (e) | 670 (lambda (e) |
670 (let ((dir (file-name-directory | 671 (let ((dir (file-name-directory |
671 (recentf-menu-element-value e)))) | 672 (recentf-menu-element-value e)))) |
677 (cons (concat d " (%d)") | 678 (cons (concat d " (%d)") |
678 (concat "\\`" d)))) | 679 (concat "\\`" d)))) |
679 (nreverse (sort dirs 'string-lessp))))) | 680 (nreverse (sort dirs 'string-lessp))))) |
680 | 681 |
681 (defun recentf-file-name-nondir (l) | 682 (defun recentf-file-name-nondir (l) |
682 "Filter the list of menu-elements L to show only filenames. This | 683 "Filter the list of menu-elements L to show only filenames. |
683 simplified version of `recentf-show-basenames' do not handle | 684 This simplified version of `recentf-show-basenames' does not handle |
684 duplicates. It is used by `recentf-arrange-by-dir' as its | 685 duplicates. It is used by `recentf-arrange-by-dir' as its |
685 `recentf-arrange-by-rule-subfilter'." | 686 `recentf-arrange-by-rule-subfilter'." |
686 (mapcar (function | 687 (mapcar (function |
687 (lambda (e) | 688 (lambda (e) |
688 (recentf-make-menu-element | 689 (recentf-make-menu-element |
689 (file-name-nondirectory (recentf-menu-element-value e)) | 690 (file-name-nondirectory (recentf-menu-element-value e)) |
690 (recentf-menu-element-value e)))) | 691 (recentf-menu-element-value e)))) |
691 l)) | 692 l)) |
692 | 693 |
693 (defun recentf-arrange-by-dir (l) | 694 (defun recentf-arrange-by-dir (l) |
694 "Filter the list of menu-elements L to build sub-menus for each | 695 "Filter the list of menu-elements L to build sub-menus for each directory." |
695 directory." | |
696 (let ((recentf-arrange-rules (recentf-build-dir-rules l)) | 696 (let ((recentf-arrange-rules (recentf-build-dir-rules l)) |
697 (recentf-arrange-by-rule-subfilter 'recentf-file-name-nondir) | 697 (recentf-arrange-by-rule-subfilter 'recentf-file-name-nondir) |
698 recentf-arrange-by-rule-others) | 698 recentf-arrange-by-rule-others) |
699 (nreverse (recentf-arrange-by-rule l)))) | 699 (nreverse (recentf-arrange-by-rule l)))) |
700 | 700 |
745 (setq filters (cdr filters))))) | 745 (setq filters (cdr filters))))) |
746 (if (consp filters) | 746 (if (consp filters) |
747 (car filters)))) | 747 (car filters)))) |
748 | 748 |
749 (defun recentf-filter-changer (l) | 749 (defun recentf-filter-changer (l) |
750 "Manage a ring of filters. `recentf-filter-changer-alist' defines | 750 "Manage a ring of filters. |
751 the filters in the ring. Actual filtering of L is delegated to the | 751 `recentf-filter-changer-alist' defines the filters in the ring. |
752 current filter in the ring. A filter menu item is displayed allowing | 752 Actual filtering of L is delegated to the current filter in the |
753 to dynamically activate the next filter in the ring. If the filter | 753 ring. A filter menu item is displayed allowing to dynamically activate |
754 ring is empty L is left unchanged." | 754 the next filter in the ring. If the filter ring is empty L is left |
755 unchanged." | |
755 (let ((current-filter-item (recentf-filter-changer-get-current)) | 756 (let ((current-filter-item (recentf-filter-changer-get-current)) |
756 (next-filter-item (recentf-filter-changer-get-next))) | 757 (next-filter-item (recentf-filter-changer-get-next))) |
757 (when current-filter-item | 758 (when current-filter-item |
758 (setq l (recentf-apply-menu-filter (car current-filter-item) l)) | 759 (setq l (recentf-apply-menu-filter (car current-filter-item) l)) |
759 (if next-filter-item | 760 (if next-filter-item |
766 ;;; | 767 ;;; |
767 ;;; Dialogs stuff | 768 ;;; Dialogs stuff |
768 ;;; | 769 ;;; |
769 | 770 |
770 (defun recentf-cancel-dialog (&rest ignore) | 771 (defun recentf-cancel-dialog (&rest ignore) |
771 "Cancel the current dialog. Used by `recentf-edit-list' and | 772 "Cancel the current dialog. |
772 `recentf-open-files' dialogs." | 773 Used by `recentf-edit-list' and `recentf-open-files' dialogs." |
773 (interactive) | 774 (interactive) |
774 (kill-buffer (current-buffer)) | 775 (kill-buffer (current-buffer)) |
775 (message "Dialog canceled.")) | 776 (message "Dialog canceled.")) |
776 | 777 |
777 (defvar recentf-dialog-mode-map nil | 778 (defvar recentf-dialog-mode-map nil |
819 (recentf-make-menu-items) | 820 (recentf-make-menu-items) |
820 recentf-menu-before)) | 821 recentf-menu-before)) |
821 (error nil)))) | 822 (error nil)))) |
822 | 823 |
823 (defun recentf-dump-variable (variable &optional limit) | 824 (defun recentf-dump-variable (variable &optional limit) |
824 "Insert a \"(setq VARIABLE value)\" in the current buffer. Optional | 825 "Insert a \"(setq VARIABLE value)\" in the current buffer. |
825 argument LIMIT specifies a maximum length when VARIABLE value is a | 826 Optional argument LIMIT specifies a maximum length when VARIABLE value |
826 list (default to the full list)." | 827 is a list (default to the full list)." |
827 (let ((value (symbol-value variable))) | 828 (let ((value (symbol-value variable))) |
828 (insert (format "(setq %S\n '(\n" variable)) | 829 (insert (format "(setq %S\n '(\n" variable)) |
829 (cond ((consp value) | 830 (cond ((consp value) |
830 (if (and (integerp limit) (> limit 0)) | 831 (if (and (integerp limit) (> limit 0)) |
831 (setq value (recentf-trunc-list value limit))) | 832 (setq value (recentf-trunc-list value limit))) |
851 (write-region (point-min) (point-max) recentf-save-file)) | 852 (write-region (point-min) (point-max) recentf-save-file)) |
852 (kill-buffer (current-buffer))) | 853 (kill-buffer (current-buffer))) |
853 nil) | 854 nil) |
854 | 855 |
855 (defvar recentf-edit-selected-items nil | 856 (defvar recentf-edit-selected-items nil |
856 "Used by `recentf-edit-list' to hold the list of files to be deleted | 857 "Used by `recentf-edit-list'. |
857 from `recentf-list'.") | 858 Holds list of files to be deleted from `recentf-list'.") |
858 | 859 |
859 (defun recentf-edit-list-action (widget &rest ignore) | 860 (defun recentf-edit-list-action (widget &rest ignore) |
860 "Checkbox widget action used by `recentf-edit-list' to select/unselect a file." | 861 "Checkbox widget action used by `recentf-edit-list' to select/unselect a file." |
861 (let ((value (widget-get widget ':tag))) | 862 (let ((value (widget-get widget ':tag))) |
862 ;; if value is already in the selected items | 863 ;; if value is already in the selected items |
948 "Button widget action used by `recentf-open-files' to open a file." | 949 "Button widget action used by `recentf-open-files' to open a file." |
949 (kill-buffer (current-buffer)) | 950 (kill-buffer (current-buffer)) |
950 (funcall recentf-menu-action (widget-value widget))) | 951 (funcall recentf-menu-action (widget-value widget))) |
951 | 952 |
952 (defvar recentf-open-files-item-shift "" | 953 (defvar recentf-open-files-item-shift "" |
953 "String used by `recentf-open-files' to shift right sub-menu | 954 "String used by `recentf-open-files' to shift right sub-menu items.") |
954 items.") | |
955 | 955 |
956 (defun recentf-open-files-item (menu-element) | 956 (defun recentf-open-files-item (menu-element) |
957 "Function called by `recentf-open-files' to insert a menu-element | 957 "Insert menu-element item in the current interaction buffer." |
958 item in the current interaction buffer." | |
959 (let ((menu-item (car menu-element)) | 958 (let ((menu-item (car menu-element)) |
960 (file-path (cdr menu-element))) | 959 (file-path (cdr menu-element))) |
961 (if (consp file-path) ; This is a sub-menu | 960 (if (consp file-path) ; This is a sub-menu |
962 (let* ((shift recentf-open-files-item-shift) | 961 (let* ((shift recentf-open-files-item-shift) |
963 (recentf-open-files-item-shift (concat shift " "))) | 962 (recentf-open-files-item-shift (concat shift " "))) |
977 file-path) | 976 file-path) |
978 (widget-insert "\n")))) | 977 (widget-insert "\n")))) |
979 | 978 |
980 ;;;###autoload | 979 ;;;###autoload |
981 (defun recentf-open-files (&optional files buffer-name) | 980 (defun recentf-open-files (&optional files buffer-name) |
982 "Open a buffer that allows the user to choose a file to open from | 981 "Display buffer allowing user to choose a file from recently-opened list. |
983 the list of recently opened files. The optional argument FILES may be | 982 The optional argument FILES may be used to specify the list, otherwise |
984 used to specify the list, otherwise recentf-list is used. The optional | 983 recentf-list is used. The optional argument BUFFER-NAME specifies |
985 argument BUFFER-NAME specifies which buffer to use for the interaction." | 984 which buffer to use for the interaction." |
986 (interactive) | 985 (interactive) |
987 (if (null files) | 986 (if (null files) |
988 (setq files recentf-list)) | 987 (setq files recentf-list)) |
989 (if (null buffer-name) | 988 (if (null buffer-name) |
990 (setq buffer-name (concat "*" recentf-menu-title "*"))) | 989 (setq buffer-name (concat "*" recentf-menu-title "*"))) |