]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow specifying a package name for 'package-vc-link-directory'
authorPhilip Kaludercic <philipk@posteo.net>
Wed, 12 Oct 2022 19:25:54 +0000 (21:25 +0200)
committerPhilip Kaludercic <philipk@posteo.net>
Wed, 12 Oct 2022 19:25:54 +0000 (21:25 +0200)
* lisp/emacs-lisp/package-vc.el (package-vc-link-directory): Add argument NAME

lisp/emacs-lisp/package-vc.el

index d513e9a7331886e56e2fbda279f37bec88683120..dfa8094e6145c80709840f7173beb33fd7f641bb 100644 (file)
@@ -339,9 +339,16 @@ be requested using REV."
 ;;;###autoload
 (defalias 'package-checkout #'package-vc-install)
 
-(defun package-vc-link-directory (dir)
-  "Install the package in DIR by linking it into the ELPA directory."
-  (interactive (list (read-directory-name "Directory: ")))
+(defun package-vc-link-directory (dir name)
+  "Install the package NAME in DIR by linking it into the ELPA directory.
+If invoked interactively with a prefix argument, the user will be
+prompted for the package NAME.  Otherwise it will be inferred
+from the base name of DIR."
+  (interactive (let ((dir (read-directory-name "Directory: ")))
+                 (list dir
+                       (if current-prefix-arg
+                           (read-string "Package name: ")
+                         (file-name-base (directory-file-name dir))))))
   (unless (vc-responsible-backend dir)
     (user-error "Directory %S is not under version control" dir))
   (package--archives-initialize)