public inbox for howm-eng@lists.osdn.me
 help / color / mirror / Atom feed
From: khi at users.sourceforge.jp (khi at users.sourceforge.jp)
Subject: [Howm-eng 144] Re: Note file alias
Date: Fri, 23 Feb 2018 23:50:05 +0900	[thread overview]
Message-ID: <87sh9rep5u.wl@id.domain> (raw)
In-Reply-To: <87woz4kb4g.fsf@maillard.im>

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.

-- 
khi at users.osdn.me


      reply	other threads:[~2018-02-23 14:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-12  6:12 [Howm-eng 131] " xavier
2018-02-12  6:15 ` [Howm-eng 132] " xavier
2018-02-22 13:49   ` [Howm-eng 140] " khi
2018-02-22 20:44     ` [Howm-eng 141] " xavier
2018-02-23 14:50       ` khi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sh9rep5u.wl@id.domain \
    --to=howm-eng@lists.osdn.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).