マクロ

をようやく使い始めた。

(defmacro filer-command (name key . body)
  (let ((fname (intern (concat "filer-" (string name)))))
    `(progn
       (defun ,fname () ,@body)
       (define-key filer-keymap ,key ',fname))))
(setf (get 'filer-command 'lisp-indent-hook) 'defun)

(defun copy-and-show (str) (copy-to-clipboard str) (message str))

;http://www.inference.phy.cam.ac.uk/rpa23/code/cl-gnuplot.mac-sbcl.lisp
(defun string-join (delimiter strings) 
  (format nil (format nil "~~{~~a~~^~a~~}" delimiter) strings))

(defun filer-current-file-or-files-as-string ()
  (let ((marks (filer-get-mark-files)))
    (if marks
      (string-join "\n" marks)
      (filer-get-current-file))))

(filer-command path-to-clipboard #\C-c
  (copy-and-show (filer-current-file-or-files-as-string)))
(filer-command path-to-clipboard-bs #\C-C
  (copy-and-show
   (map-slash-to-backslash (filer-current-file-or-files-as-string))))
(define-key filer-keymap #\M-C-c 'filer-path-to-clipboard-bs)

(filer-command discard #\C-d ; to recycle
  (let ((marks (filer-get-mark-files)))
    (if marks
      (dolist (mark marks) (delete-file mark :recycle t))
      (delete-file (filer-get-current-file) :recycle t)))
  (filer-reload))

*1
*2

*1:08-11-08 make-symbol -> intern

*2:08-11-29 multicopy, filer-discard