aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-10-08 16:34:14 +0000
committerDave Love2000-10-08 16:34:14 +0000
commitfdd63a1c869c67c2cfdcb6b0e4814c844dd87b66 (patch)
treeebfcd7e0b510baafdc8e6404d83a27cca6588e6f
parentdf003ee6abf255660c89a9f9ae9848b0feb54b4b (diff)
downloademacs-fdd63a1c869c67c2cfdcb6b0e4814c844dd87b66.tar.gz
emacs-fdd63a1c869c67c2cfdcb6b0e4814c844dd87b66.zip
Doc fixes.
-rw-r--r--lisp/recentf.el127
1 files changed, 63 insertions, 64 deletions
diff --git a/lisp/recentf.el b/lisp/recentf.el
index ab063353fed..eba1697150f 100644
--- a/lisp/recentf.el
+++ b/lisp/recentf.el
@@ -35,7 +35,7 @@
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
@@ -63,7 +63,7 @@
63 "Function called when menu customization has changed. 63 "Function called when menu customization has changed.
64It removes the recentf menu and forces its complete redrawing." 64It 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))
@@ -120,7 +120,7 @@ If nil add it at end of menu (see also `easy-menu-change')."
120 "*Function to invoke with a filename item of the recentf menu. 120 "*Function to invoke with a filename item of the recentf menu.
121The default action `recentf-find-file' calls `find-file' to edit an 121The default action `recentf-find-file' calls `find-file' to edit an
122existing file. If the file does not exist or is not readable, it is 122existing file. If the file does not exist or is not readable, it is
123not edited and its name is removed from `recentf-list'. You can use 123not 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
125list of recently opened files." 125list of recently opened files."
126 :group 'recentf 126 :group 'recentf
@@ -254,7 +254,7 @@ 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
@@ -282,22 +282,23 @@ A menu element is a pair (MENU-ITEM . MENU-VALUE) where:
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).
286given recent file path FILE-PATH. MENU-ITEM and MENU-VALUE are set to 286Do so for the given recent file path FILE-PATH. MENU-ITEM and
287FILE-PATH. See also `recentf-make-menu-element'." 287MENU-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'." 293See 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.
298menu-elements L. It takes care of sub-menu elements in L and 299It takes care of sub-menu elements in L and recursively apply FILTER
299recursively apply FILTER to them. It is guarantee than FILTER receives 300to them. It is guarantee than FILTER receives only a list of single
300only a list of single menu-elements (no sub-menu)." 301menu-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)
@@ -417,8 +418,8 @@ Only file names (without directories) are compared."
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.
421non-nil if P1 is less than P2." 422Return 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))
@@ -447,7 +448,7 @@ Compares directories then filenames to order the list."
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)
450in the menu. When file names are duplicated their directory component is added." 451in 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
@@ -476,20 +477,22 @@ in the menu. When file names are duplicated their directory component is added."
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.
480sorted in ascending order. This filter combines the `recentf-sort-basenames-ascending' 481Show only file names in the menu, sorted in ascending order. This
481and `recentf-show-basenames' filters." 482filter 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.
486sorted in descending order. This filter combines the `recentf-sort-basenames-descending' 488Show only file names in the menu, sorted in descending order. This
487and `recentf-show-basenames' filters." 489filter 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.
492relative to `default-directory'." 495Show 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)
@@ -507,21 +510,21 @@ relative to `default-directory'."
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.
510A rule is a pair (SUB-MENU-TITLE . MATCHER). SUB-MENU-TITLE is the 513A rule is a pair (SUB-MENU-TITLE . MATCHER). SUB-MENU-TITLE is the
511displayed title of the sub-menu where a '%d' `format' pattern is 514displayed title of the sub-menu where a '%d' `format' pattern is
512replaced by the number of items in the sub-menu. MATCHER is a regexp 515replaced by the number of items in the sub-menu. MATCHER is a regexp
513or a list of regexps. Items matching one of the regular expressions in 516or a list of regexps. Items matching one of the regular expressions in
514MATCHER are added to the corresponding sub-menu." 517MATCHER 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.
521don't match any `recentf-arrange-rules' are displayed. If nil 524This is for the menu where items that don't match any
522these 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 526displayed in the main recent files menu. A '%d' `format' pattern in
524the sub-menu." 527the 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"))
@@ -539,7 +542,7 @@ defined."
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.
542Nil means no filter. See also `recentf-menu-filter'. You can't use 545Nil 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
@@ -559,8 +562,8 @@ See `recentf-arrange-rules' for details on 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.
563following rules in `recentf-arrange-rules'." 566Arrange 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
@@ -655,15 +658,13 @@ following rules in `recentf-arrange-rules'."
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."
659major 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)
@@ -679,9 +680,9 @@ major mode."
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.
683simplified version of `recentf-show-basenames' do not handle 684This simplified version of `recentf-show-basenames' does not handle
684duplicates. It is used by `recentf-arrange-by-dir' as its 685duplicates. 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)
@@ -691,8 +692,7 @@ duplicates. It is used by `recentf-arrange-by-dir' as its
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."
695directory."
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)
@@ -747,11 +747,12 @@ Each filter is defined by a pair (FILTER-FUN . FILTER-LBL) where:
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.
751the filters in the ring. Actual filtering of L is delegated to the 751`recentf-filter-changer-alist' defines the filters in the ring.
752current filter in the ring. A filter menu item is displayed allowing 752Actual filtering of L is delegated to the current filter in the
753to dynamically activate the next filter in the ring. If the filter 753ring. A filter menu item is displayed allowing to dynamically activate
754ring is empty L is left unchanged." 754the next filter in the ring. If the filter ring is empty L is left
755unchanged."
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
@@ -768,8 +769,8 @@ ring is empty L is left unchanged."
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." 773Used 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."))
@@ -821,9 +822,9 @@ These are the special commands of recentf-dialog-mode mode:
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.
825argument LIMIT specifies a maximum length when VARIABLE value is a 826Optional argument LIMIT specifies a maximum length when VARIABLE value
826list (default to the full list)." 827is 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)
@@ -853,8 +854,8 @@ list (default to the full list)."
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'.
857from `recentf-list'.") 858Holds 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."
@@ -950,12 +951,10 @@ from `recentf-list'.")
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.")
954items.")
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."
958item 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
@@ -979,10 +978,10 @@ item in the current interaction buffer."
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.
983the list of recently opened files. The optional argument FILES may be 982The optional argument FILES may be used to specify the list, otherwise
984used to specify the list, otherwise recentf-list is used. The optional 983recentf-list is used. The optional argument BUFFER-NAME specifies
985argument BUFFER-NAME specifies which buffer to use for the interaction." 984which 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))