Add require/ function

This commit is contained in:
Case Duckworth 2021-10-07 16:00:39 -05:00
parent fc03087cc0
commit 90056b3191
1 changed files with 17 additions and 1 deletions

View File

@ -878,7 +878,23 @@ three blank lines, then place the point on the second one."
(newline)
(delete-blank-lines)
(newline 2)
(previous-line))
(forward-line -1))
(defun require/ (feature &optional filename noerror)
"If FEATURE is not loaded, load it from FILENAME.
This function works just like `require', with one crucial
difference: if the FEATURE name contains a slash, the FILENAME
will as well -- unless, of course, FILENAME is set. This allows
for `require/' to require files within subdirectories of
directories of `load-path'. Of course, NOERROR isn't affected by
the change."
(let* ((feature-name (if (symbolp feature)
(symbol-name feature)
feature))
(filename (or filename
(and (string-match-p "/" feature-name)
feature-name))))
(require (intern feature-name) filename noerror)))
(provide 'acdw)
;;; acdw.el ends here