Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun list-notes (order)
- (interactive "P")
- (let* (
- (find-cmd "cd /home/estragon/org/labnotes ; find . -maxdepth 3 -mindepth 3 -type d -print0")
- ;; Alphabetical order with prefix arg; last-touched order without
- (sorted-cmd (concat find-cmd " | xargs -0 ls -d" (if order "" "t") " -- "
- (if order " | sort -r" "")))
- (note-dirs (split-string (shell-command-to-string sorted-cmd)))
- (dired-note-list (cons "/home/estragon/org/labnotes/labnotes" note-dirs))
- )
- (require 'dired)
- (switch-to-buffer (dired-internal-noselect dired-note-list "-ld"))))
- (defun list-search (search-string &optional filter)
- (interactive
- (split-string (read-string "Search text: ") "|"))
- (let* ((search-cmd-template
- (concat
- "cd ~/org/labnotes ; "
- "swish-e -H0 -w '%s' -x '<swishdocpath>\n' | "
- (if filter (format "grep '%s' | " filter) "")
- "xargs ls -t --"))
- (search-cmd (format search-cmd-template search-string))
- (targets (split-string (shell-command-to-string search-cmd)))
- (trunctargs (mapcar
- (lambda (p)
- (replace-regexp-in-string
- "/home/estragon/org/labnotes/" "./" p))
- targets))
- (dired-target-list (cons "/home/estragon/org/labnotes/labnotes"
- trunctargs))
- )
- (require 'dired)
- (switch-to-buffer (dired-internal-noselect dired-target-list "-l"))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement