/JyByLisp

Elisp code that I found useful

GNU General Public License v3.0GPL-3.0

JyByLisp

global-force-set-key

A recurrent task in my configuration file is to unset a key, and then to set it to a particular function. I programmed the following function to group both into one single operation:

(defun jyby/global-force-set-key (key command)
  "Unset globally the key KEY, then binds it globally to the function COMMAND.

For instance, it can be used to write
  (jyby/global-force-set-key [f2] 'org-clock-goto)	     
instead of 
  (global-unset-key [f2])    
  (global-set-key [f2] 'org-clock-goto)
" 
  (global-unset-key key)
  (global-set-key key command)	     
  )

tex-to-org

Whereas org-mode makes it easy to to export from org to tex, I sometimes have to perform the reverse operation. Here is a first draft of a function which helps with some of the most basic transformations, usefull for some paragraphs.

(defun jyby/tex-to-org ()
  (interactive)
  "Replace various latex commands by the corresponding orgmode equivalent."

  (replace-regexp "\\\\emph\{\\([a-zA-Z ,.]*\\)\}" "/\\1/")
  (replace-regexp "\\\\textbf\{\\([a-z,A-Z,0-9, \,]*\\)\}" "*\\1*")
  (replace-regexp "\\\\texttt\{\\([a-z,A-Z]*\\)\}" "=\\1=")
  (replace-regexp "\\\\begin\{LONG\}" "")
  (replace-regexp "\\\\end\{LONG\}" "")
  )

clever-archive

A variant of org-archive-to-archive-sibling and org-archive-subtree which archive a subtree to an archive file, but recreates if necessary all its ancestor nodes in the archive file.

REFERENCE

CODE