From 0596d60e9cac133946fc435a4ffacfdd03a7906e Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 13 Jan 2017 17:46:35 +0100 Subject: emacs: fix kbd tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- emacs/init.org | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'emacs/init.org') diff --git a/emacs/init.org b/emacs/init.org index 4410d27..9be404f 100644 --- a/emacs/init.org +++ b/emacs/init.org @@ -347,7 +347,7 @@ Sometimes I want to debug my initialization time. * Lisp packages ** Custom packages -Compile the =g.el= script and bind it to M-g. +Compile the =g.el= script and bind it to @@html:M-g@@. #+BEGIN_SRC elisp (byte-compile-file (concat user-emacs-directory "lisp/g.el") t) @@ -453,7 +453,7 @@ Then, for keeping up with my projects I use the Projectile + Helm combination. #+END_SRC Finally, I've added a couple of bindings in evil mode. First of all, I want -C-p to use the proper function for finding files. +@@html:C-p@@ to use the proper function for finding files. #+BEGIN_SRC elisp (defun mssola-find-file () @@ -471,7 +471,7 @@ Finally, I've added a couple of bindings in evil mode. First of all, I want #+END_SRC Similarly, =helm-ag= has two functions for applying =ag= on the project. I'm -binding to leader-a a function that calls to the proper function. +binding to @@html:,a@@ a function that calls to the proper function. #+BEGIN_SRC elisp (defun mssola-helm-ag () @@ -623,7 +623,7 @@ whenever I use it, I want basic evil movement. And now instruct dired mode how to attach files when using mu4e. This is taken from the [[https://www.djcbsoftware.nl/code/mu/mu4e/Dired.html#Dired][mu4e documentation]], and it's available by typing -C-cRETC-a. +@@html:C-c@@@@html:RET@@@@html:C-a@@. #+BEGIN_SRC elisp (require 'gnus-dired) @@ -1279,6 +1279,26 @@ The prefix for the different kinds of types being used. (todo . "%c:%t%s"))) #+END_SRC +Insert a value in org mode. See this [[http://emacs.stackexchange.com/questions/2206/i-want-to-have-the-kbd-tags-for-my-blog-written-in-org-mode][StackExchange answer]]. + +#+BEGIN_SRC elisp +(defun endless/insert-key (key) + "Ask for a key then insert its description. +Will work on both org-mode and any mode that accepts plain html." + (interactive "kType key sequence: ") + (let* ((is-org-mode (derived-mode-p 'org-mode)) + (tag (if is-org-mode + "@@html:%s@@" + "%s"))) + (if (null (equal key "\r")) + (insert + (format tag (help-key-description key nil))) + (insert (format tag "")) + (forward-char (if is-org-mode -8 -6))))) + +(define-key org-mode-map "\C-ck" #'endless/insert-key) +#+END_SRC + ** TODO shortcut for making an org link, and transforming a link into a proper org link ** TODO make it work with evil ** TODO Proper keybindings for quick access. -- cgit v1.2.3