From 90056b3191eddccee2954b36ee77137fdec5ce29 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 7 Oct 2021 16:00:39 -0500 Subject: [PATCH] Add require/ function --- lisp/acdw.el | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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." (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