At Thu, 22 Feb 2018 21:44:31 +0100,
Xavier Maillard wrote:
> Yeah, that is definetely what I am looking for with one exception: I
> want to give a name to that alias and, maybe, I'd want it to be
> included in the *howm* menu buffer.

This is a modified version.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar my-make-symlink-dir "~/foo/")
(defun my-make-symlink ()
  "Make a symbolic link to the current buffer's file under 
`my-make-symlink-dir'."
  (interactive)
  (mkdir (expand-file-name my-make-symlink-dir) t)
  (let* ((f (buffer-file-name))
         (af (abbreviate-file-name f))
         (b (file-name-nondirectory f))
         (l (expand-file-name (read-file-name (format "link name to %s: " af)
                                              my-make-symlink-dir b nil b)
                              my-make-symlink-dir))
         (al (abbreviate-file-name l)))
    (make-symbolic-link f l)
    (message (format "%s -> %s" al af))))

(defun my-embed-directory-files (dir)
  (apply #'concat
         (mapcar (lambda (f) (format "file://%s\n" (abbreviate-file-name f)))
                 (directory-files (expand-file-name dir) t "^[^.]"))))

;; after (require 'howm)
(add-to-list 'howm-menu-allow 'my-embed-directory-files)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

If you add
    %here%(my-embed-directory-files "~/foo")
    %"Link" %| %call%my-make-symlink %|
into the menu file ~/howm/0000-00-00-000000.txt,
the contents in ~/foo are embedded into the howm menu.
You can also call my-make-symlink with the key "L" in the menu.

-- 
k...@users.osdn.me

_______________________________________________
Howm-eng mailing list
Howm-eng@lists.osdn.me
https://lists.osdn.me/mailman/listinfo/howm-eng

Reply via email to