comparison lisp/recentf.el @ 38662:dd6bc9395c61

(recentf-dump-variable): Handle a value of nil correctly.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 02 Aug 2001 10:54:25 +0000
parents b174db545cfd
children 7308bbc423d5
comparison
equal deleted inserted replaced
38661:2511f86ea47a 38662:dd6bc9395c61
1 ;;; recentf.el --- setup a menu of recently opened files 1 ;;; recentf.el --- setup a menu of recently opened files
2 2
3 ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc. 3 ;; Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
4 4
5 ;; Author: David Ponce <david@dponce.com> 5 ;; Author: David Ponce <david@dponce.com>
6 ;; Created: July 19 1999 6 ;; Created: July 19 1999
7 ;; Keywords: customization 7 ;; Keywords: customization
8 8
844 (defun recentf-dump-variable (variable &optional limit) 844 (defun recentf-dump-variable (variable &optional limit)
845 "Insert a \"(setq VARIABLE value)\" in the current buffer. 845 "Insert a \"(setq VARIABLE value)\" in the current buffer.
846 Optional argument LIMIT specifies a maximum length when VARIABLE value 846 Optional argument LIMIT specifies a maximum length when VARIABLE value
847 is a list (default to the full list)." 847 is a list (default to the full list)."
848 (let ((value (symbol-value variable))) 848 (let ((value (symbol-value variable)))
849 (insert (format "(setq %S\n '(\n" variable)) 849 (if (listp value)
850 (cond ((consp value) 850 (progn
851 (if (and (integerp limit) (> limit 0)) 851 (when (and (integerp limit) (> limit 0))
852 (setq value (recentf-trunc-list value limit))) 852 (setq value (recentf-trunc-list value limit)))
853 (mapc (function 853 (insert (format "(setq %S '(" variable))
854 (lambda (e) 854 (mapc (lambda (e) (insert (format "\n%S" e))) value)
855 (insert (format " %S\n" e)))) 855 (insert "))\n"))
856 value)) 856 (insert (format "(setq %S %S)\n" variable value)))))
857 (t
858 (insert (format " %S\n" value))))
859 (insert " ))\n")
860 ))
861 857
862 ;;;###autoload 858 ;;;###autoload
863 (defun recentf-save-list () 859 (defun recentf-save-list ()
864 "Save the current `recentf-list' to the file `recentf-save-file'." 860 "Save the current `recentf-list' to the file `recentf-save-file'."
865 (interactive) 861 (interactive)