diff options
author | Case Duckworth | 2021-10-07 16:00:39 -0500 |
---|---|---|
committer | Case Duckworth | 2021-10-07 16:00:39 -0500 |
commit | 90056b3191eddccee2954b36ee77137fdec5ce29 (patch) | |
tree | 24e8b34c1ad4556e54cbbf68c850c68f5b0aa834 /lisp | |
parent | Add README.org (diff) | |
download | emacs-90056b3191eddccee2954b36ee77137fdec5ce29.tar.gz emacs-90056b3191eddccee2954b36ee77137fdec5ce29.zip |
Add require/ function
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/acdw.el | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index cc73071..50ca00c 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -878,7 +878,23 @@ three blank lines, then place the point on the second one." | |||
878 | (newline) | 878 | (newline) |
879 | (delete-blank-lines) | 879 | (delete-blank-lines) |
880 | (newline 2) | 880 | (newline 2) |
881 | (previous-line)) | 881 | (forward-line -1)) |
882 | |||
883 | (defun require/ (feature &optional filename noerror) | ||
884 | "If FEATURE is not loaded, load it from FILENAME. | ||
885 | This function works just like `require', with one crucial | ||
886 | difference: if the FEATURE name contains a slash, the FILENAME | ||
887 | will as well -- unless, of course, FILENAME is set. This allows | ||
888 | for `require/' to require files within subdirectories of | ||
889 | directories of `load-path'. Of course, NOERROR isn't affected by | ||
890 | the change." | ||
891 | (let* ((feature-name (if (symbolp feature) | ||
892 | (symbol-name feature) | ||
893 | feature)) | ||
894 | (filename (or filename | ||
895 | (and (string-match-p "/" feature-name) | ||
896 | feature-name)))) | ||
897 | (require (intern feature-name) filename noerror))) | ||
882 | 898 | ||
883 | (provide 'acdw) | 899 | (provide 'acdw) |
884 | ;;; acdw.el ends here | 900 | ;;; acdw.el ends here |