Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
2c3d8820
Commit
2c3d8820
authored
Mar 16, 2002
by
Stefan Monnier
Browse files
(load-completion): New function.
(load-library): Use it.
parent
1ba92e5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
lisp/files.el
lisp/files.el
+20
-1
No files found.
lisp/files.el
View file @
2c3d8820
...
...
@@ -534,10 +534,29 @@ colon-separated list of directories when resolving a relative directory name."
(read-file-name "Load file: "))))
(load (expand-file-name file) nil nil t))
(defun load-completion (string predicate action)
(if (file-name-absolute-p string)
(read-file-name-internal string predicate action)
(let ((names nil)
(suffix (concat (regexp-opt load-suffixes t) "\\'"))
(string-dir (file-name-directory string)))
(dolist (dir load-path)
(if string-dir (setq dir (expand-file-name string-dir dir)))
(when (file-directory-p dir)
(dolist (file (file-name-all-completions
(file-name-nondirectory string) dir))
(push (if string-dir (concat string-dir file) file) names)
(when (string-match suffix file)
(setq file (substring file 0 (match-beginning 0)))
(push (if string-dir (concat string-dir file) file) names)))))
(if action
(all-completions string (mapcar 'list names) predicate)
(try-completion string (mapcar 'list names) predicate)))))
(defun load-library (library)
"Load the library named LIBRARY.
This is an interface to the function `load'."
(interactive
"sLoad library: "
)
(interactive
(list (completing-read "Load library: " 'load-completion))
)
(load library))
(defun file-local-copy (file)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment