Skip to content

Instantly share code, notes, and snippets.

View kkatsuyuki's full-sized avatar

KKatsuyuki kkatsuyuki

View GitHub Profile
@kkatsuyuki
kkatsuyuki / org-auto-export-project.el
Created January 21, 2018 03:58
auto-export every time you edit and save an org-file in your project directory
(defun org-auto-export-project ()
(let ((project
(catch 'is-project-dir
(dolist (each-project org-publish-project-alist)
(if (string-match
(expand-file-name (plist-get (cdr each-project) :base-directory))
(expand-file-name buffer-file-name))
(throw 'is-project-dir (car each-project)))))))
(if project
(save-excursion (org-publish-project project)))))
@kkatsuyuki
kkatsuyuki / eshell-completion.el
Last active July 9, 2017 17:31
On eshell, complete sudo, pacman, systemctl commands
;; ============================================================
;;
;; sudo completion
;;
;; ============================================================
(defun pcomplete/sudo ()
"Completion rules for the `sudo' command."
(let ((pcomplete-ignore-case t))
(pcomplete-here (funcall pcomplete-command-completion-function))
(cond ((pcomplete-test "pacman")
@kkatsuyuki
kkatsuyuki / eshell-bmk.el
Last active June 4, 2017 07:11
another eshell/bmk : cd to the bookmark dir, add the current dir to the bookmark, show the bookmark list, delete the bookmark entry
;; another eshell/bmk
(defun pcomplete/eshell-mode/bmk ()
"Completion for `bmk'"
(pcomplete-opt "adl")
(pcomplete-here (bookmark-all-names)))
(defun show-bmk-list ()
"Show the registed bookmark list and each corresponding path"
(let (output-string bmk-name bmk-path (each-format "%-15s|%-5s|%s