Commit f5515fa8 authored by Stefan Kangas's avatar Stefan Kangas
Browse files

Convert several defsubst to defun in recentf.el

* lisp/recentf.el (recentf-enabled-p, recentf-string-equal)
(recentf-string-lessp, recentf-push, recentf-expand-file-name)
(recentf-add-file, recentf-remove-if-non-kept)
(recentf-digit-shortcut-command-name, recentf-elements)
(recentf-menu-bar, recentf-sort-ascending)
(recentf-sort-descending, recentf-sort-basenames-ascending)
(recentf-sort-basenames-descending)
(recentf-sort-directories-ascending)
(recentf-sort-directories-descending)
(recentf-show-basenames-ascending)
(recentf-show-basenames-descending): Change from defsubst to
defun.
parent feb88fa8
......@@ -47,9 +47,10 @@
(defvar recentf-list nil
"List of recently opened files.")
(defsubst recentf-enabled-p ()
(defun recentf-enabled-p ()
"Return non-nil if recentf mode is currently enabled."
(memq 'recentf-save-list kill-emacs-hook))
;;; Customization
;;
......@@ -313,14 +314,14 @@ used as shortcuts to open the Nth file."
(memq system-type '(windows-nt cygwin))
"Non-nil if recentf searches and matches should ignore case.")
(defsubst recentf-string-equal (s1 s2)
(defun recentf-string-equal (s1 s2)
"Return non-nil if strings S1 and S2 have identical contents.
Ignore case if `recentf-case-fold-search' is non-nil."
(if recentf-case-fold-search
(string-equal (downcase s1) (downcase s2))
(string-equal s1 s2)))
(defsubst recentf-string-lessp (s1 s2)
(defun recentf-string-lessp (s1 s2)
"Return non-nil if string S1 is less than S2 in lexicographic order.
Ignore case if `recentf-case-fold-search' is non-nil."
(if recentf-case-fold-search
......@@ -375,7 +376,7 @@ See also the option `recentf-auto-cleanup'.")
;;; File functions
;;
(defsubst recentf-push (filename)
(defun recentf-push (filename)
"Push FILENAME into the recent list, if it isn't there yet.
If it is there yet, move it at the beginning of the list.
If `recentf-case-fold-search' is non-nil, ignore case when comparing
......@@ -398,7 +399,7 @@ returned nil."
(error nil))
name))
(defsubst recentf-expand-file-name (name)
(defun recentf-expand-file-name (name)
"Convert file NAME to absolute, and canonicalize it.
NAME is first passed to the function `expand-file-name', then to
`recentf-filename-handlers' to post process it."
......@@ -439,7 +440,7 @@ That is, if it matches any of the `recentf-keep' checks."
checks (cdr checks)))
keepit))
(defsubst recentf-add-file (filename)
(defun recentf-add-file (filename)
"Add or move FILENAME at the beginning of the recent list.
Does nothing if the name satisfies any of the `recentf-exclude'
regexps or predicates."
......@@ -447,7 +448,7 @@ regexps or predicates."
(when (recentf-include-p filename)
(recentf-push filename)))
(defsubst recentf-remove-if-non-kept (filename)
(defun recentf-remove-if-non-kept (filename)
"Remove FILENAME from the recent list, if file is not kept.
Return non-nil if FILENAME has been removed."
(unless (recentf-keep-p filename)
......@@ -468,7 +469,7 @@ Return non-nil if F1 is less than F2."
;;; Menu building
;;
(defsubst recentf-digit-shortcut-command-name (n)
(defun recentf-digit-shortcut-command-name (n)
"Return a command name to open the Nth most recent file.
See also the command `recentf-open-most-recent-file'."
(intern (format "recentf-open-most-recent-file-%d" n)))
......@@ -514,7 +515,7 @@ If non-nil it must contain a list of valid menu-items to be appended
to the recent file list part of the menu. Before calling a menu
filter function this variable is reset to nil.")
(defsubst recentf-elements (n)
(defun recentf-elements (n)
"Return a list of the first N elements of the recent list."
(seq-take recentf-list n))
......@@ -654,7 +655,7 @@ Return nil if file NAME is not one of the ten more recent."
:help (concat "Open " value)
:active t)))))
(defsubst recentf-menu-bar ()
(defun recentf-menu-bar ()
"Return the keymap of the global menu bar."
(lookup-key global-map [menu-bar]))
......@@ -674,7 +675,7 @@ Return nil if file NAME is not one of the ten more recent."
;;; Predefined menu filters
;;
(defsubst recentf-sort-ascending (l)
(defun recentf-sort-ascending (l)
"Sort the list of menu elements L in ascending order.
The MENU-ITEM part of each menu element is compared."
(sort (copy-sequence l)
......@@ -683,7 +684,7 @@ The MENU-ITEM part of each menu element is compared."
(recentf-menu-element-item e1)
(recentf-menu-element-item e2)))))
(defsubst recentf-sort-descending (l)
(defun recentf-sort-descending (l)
"Sort the list of menu elements L in descending order.
The MENU-ITEM part of each menu element is compared."
(sort (copy-sequence l)
......@@ -692,7 +693,7 @@ The MENU-ITEM part of each menu element is compared."
(recentf-menu-element-item e2)
(recentf-menu-element-item e1)))))
(defsubst recentf-sort-basenames-ascending (l)
(defun recentf-sort-basenames-ascending (l)
"Sort the list of menu elements L in ascending order.
Only filenames sans directory are compared."
(sort (copy-sequence l)
......@@ -701,7 +702,7 @@ Only filenames sans directory are compared."
(file-name-nondirectory (recentf-menu-element-value e1))
(file-name-nondirectory (recentf-menu-element-value e2))))))
(defsubst recentf-sort-basenames-descending (l)
(defun recentf-sort-basenames-descending (l)
"Sort the list of menu elements L in descending order.
Only filenames sans directory are compared."
(sort (copy-sequence l)
......@@ -710,7 +711,7 @@ Only filenames sans directory are compared."
(file-name-nondirectory (recentf-menu-element-value e2))
(file-name-nondirectory (recentf-menu-element-value e1))))))
(defsubst recentf-sort-directories-ascending (l)
(defun recentf-sort-directories-ascending (l)
"Sort the list of menu elements L in ascending order.
Compares directories then filenames to order the list."
(sort (copy-sequence l)
......@@ -719,7 +720,7 @@ Compares directories then filenames to order the list."
(recentf-menu-element-value e1)
(recentf-menu-element-value e2)))))
(defsubst recentf-sort-directories-descending (l)
(defun recentf-sort-directories-descending (l)
"Sort the list of menu elements L in descending order.
Compares directories then filenames to order the list."
(sort (copy-sequence l)
......@@ -756,14 +757,14 @@ When a filename is duplicated, it is appended a sequence number if
optional argument NO-DIR is non-nil, or its directory otherwise."
(recentf--filter-names l no-dir #'file-name-nondirectory))
(defsubst recentf-show-basenames-ascending (l)
(defun recentf-show-basenames-ascending (l)
"Filter the list of menu elements L to show filenames sans directory.
Filenames are sorted in ascending order.
This filter combines the `recentf-sort-basenames-ascending' and
`recentf-show-basenames' filters."
(recentf-show-basenames (recentf-sort-basenames-ascending l)))
(defsubst recentf-show-basenames-descending (l)
(defun recentf-show-basenames-descending (l)
"Filter the list of menu elements L to show filenames sans directory.
Filenames are sorted in descending order.
This filter combines the `recentf-sort-basenames-descending' and
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment