From: Tom Breton (Tehom) Date: Mon, 10 Jan 2011 02:55:02 +0000 (-0500) Subject: elinstall-symlink-on-emacs-start now can accept slashed project names X-Git-Url: https://repo.or.cz/w/elinstall.git/commitdiff_plain/7c571ea03fd777e673fa7fcf4349e188570bd622 elinstall-symlink-on-emacs-start now can accept slashed project names --- diff --git a/elinstall.el b/elinstall.el index 7346cb6..ec1c7e9 100644 --- a/elinstall.el +++ b/elinstall.el @@ -788,44 +788,42 @@ PRIORITY must be an integer or nil." (let* ( (priority (or priority elinstall-default-priority)) - ;;$$IMPROVE ME If target-basename has a directory part, - ;;split it and format priority onto it. So join those args - ;;and resplit them. + ;;We join and re-split in case TARGET-BASENAME includes a + ;;directory part. + (full-path + (expand-file-name target-basename target-dir)) + (target-dir + (file-name-directory full-path)) (target-name-nodir (format "%d%s.el" priority - target-basename)) + (file-name-nondirectory full-path))) (target (expand-file-name target-name-nodir target-dir))) - - (cond - ;;Path should already exist. - ((not - (file-exists-p target-dir)) - (message "The target directory doesn't exist.")) - ;;$$IMPROVE ME If it is a symlink pointing to the same place, - ;;do nothing. - - ;;$$IMPROVE ME The condition here is really not updating but - ;;bulldozing a possibly different symlink. Add another - ;;treatment symbol meaning to bulldoze what's in the way. - ((elinstall-proceed-p 'preloads - (list - '( "Symlink %s? " - "Really overwrite %s? " - "File %s already exists") - target) - (file-exists-p target)) - ;;Does nothing if file already exists. - (make-directory (file-name-directory target) t) - (make-symbolic-link - filename - target - ;;We already checked file-existence wrt user - ;;preferences, so force creation. - t))))) + ;;$$IMPROVE ME If it is a symlink pointing to the same place, + ;;do nothing. + + ;;$$IMPROVE ME The condition here is really not updating but + ;;bulldozing a possibly different symlink. Add another + ;;treatment symbol meaning to bulldoze what's in the way. + (when + (elinstall-proceed-p 'preloads + (list + '( "Symlink %s? " + "Really overwrite %s? " + "File %s already exists") + target) + (file-exists-p target)) + ;;Does nothing if file already exists. + (make-directory (file-name-directory target) t) + (make-symbolic-link + filename + target + ;;We already checked file-existence wrt user + ;;preferences, so force creation. + t)))) ;;;_ . elinstall-add-to-dot-emacs (defun elinstall-add-to-dot-emacs (dot-emacs-name filename &rest r)