chiark / gitweb /
el/dot-emacs.el: Gather up the Org-mode hacking.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 22 Jun 2024 10:47:04 +0000 (11:47 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 22 Jun 2024 10:47:04 +0000 (11:47 +0100)
el/dot-emacs.el

index ef46c62170d88259f92fa4bd4a8af5a14151cb95..34f08061379d0b69d776cbc2606d702be121812a 100644 (file)
@@ -318,10 +318,6 @@ (defun mdw-todo (&optional when)
                                (nth 2 when))))))))
     (eq w d)))
 
-(defadvice org-agenda-list (around mdw-preserve-links activate)
-  (let ((mdw-diary-for-org-mode-p t))
-    ad-do-it))
-
 (defcustom diary-time-regexp nil
   "Regexp matching times in the diary buffer."
   :type 'regexp)
@@ -353,115 +349,6 @@ (defadvice diary-add-to-list (before mdw-trim-leading-space compile activate)
        (if (equal str old) (setq done t)))
       (ad-set-arg 1 str))))
 
-(defadvice org-bbdb-anniversaries (after mdw-fixup-list compile activate)
-  "Return a string rather than a list."
-  (with-temp-buffer
-    (let ((anyp nil))
-      (dolist (e (let ((ee ad-return-value))
-                  (if (atom ee) (list ee) ee)))
-       (when e
-         (when anyp (insert ?\n))
-         (insert e)
-         (setq anyp t)))
-      (setq ad-return-value
-             (and anyp (buffer-string))))))
-
-;; Fighting with Org-mode's evil key maps.
-
-(defcustom mdw-evil-keymap-keys
-  '(([S-up] . [?\C-c up])
-    ([S-down] . [?\C-c down])
-    ([S-left] . [?\C-c left])
-    ([S-right] . [?\C-c right])
-    (([M-up] [?\e up]) . [C-up])
-    (([M-down] [?\e down]) . [C-down])
-    (([M-left] [?\e left]) . [C-left])
-    (([M-right] [?\e right]) . [C-right]))
-  "Defines evil keybindings to clobber in `mdw-clobber-evil-keymap'.
-The value is an alist mapping evil keys (as a list, or singleton)
-to good keys (in the same form)."
-  :type '(alist :key-type (choice key-sequence (repeat key-sequence))
-               :value-type key-sequence))
-
-(defun mdw-clobber-evil-keymap (keymap)
-  "Replace evil key bindings in the KEYMAP.
-Evil key bindings are defined in `mdw-evil-keymap-keys'."
-  (dolist (entry mdw-evil-keymap-keys)
-    (let ((binding nil)
-         (keys (if (listp (car entry))
-                   (car entry)
-                 (list (car entry))))
-         (replacements (if (listp (cdr entry))
-                           (cdr entry)
-                         (list (cdr entry)))))
-      (catch 'found
-       (dolist (key keys)
-         (setq binding (lookup-key keymap key))
-         (when binding
-           (throw 'found nil))))
-      (when binding
-       (dolist (key keys)
-         (define-key keymap key nil))
-       (dolist (key replacements)
-         (define-key keymap key binding))))))
-
-(defcustom mdw-org-latex-defs
-  '(("strayman"
-     "\\documentclass{strayman}
-\\usepackage[utf8]{inputenc}
-\\usepackage[palatino, helvetica, courier, maths=cmr]{mdwfonts}
-\\usepackage{graphicx, tikz, mdwtab, mdwmath, crypto, longtable}"
-     ("\\section{%s}" . "\\section*{%s}")
-     ("\\subsection{%s}" . "\\subsection*{%s}")
-     ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
-     ("\\paragraph{%s}" . "\\paragraph*{%s}")
-     ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
-  "Additional LaTeX class definitions."
-  :type '(alist :key-type string
-               :value-type (list string
-                                 (alist :inline t
-                                        :key-type string
-                                        :value-type string))))
-
-(setq org-emphasis-regexp-components
-       '("- \t('\"{}"                  ; prematch
-         "- \t.,:!?;'\")}\\["          ; postmatch
-         " \t\r\n"                     ; /forbidden/ as border
-         "."                           ; body regexp
-         1))                           ; maximum newlines
-
-(setq org-entities-user
-       ;; NAME LATEX MATHP HTML ASCII LATIN1 UTF8
-       '(("relax" "" nil "" "" "" "")))
-
-(eval-after-load "org-latex"
-  '(setq org-export-latex-classes
-          (append mdw-org-latex-defs org-export-latex-classes)))
-
-(eval-after-load "ox-latex"
-  '(setq org-latex-classes (append mdw-org-latex-defs org-latex-classes)
-        org-latex-caption-above nil
-        org-latex-default-packages-alist '(("AUTO" "inputenc" t)
-                                           ("T1" "fontenc" t)
-                                           ("" "fixltx2e" nil)
-                                           ("" "graphicx" t)
-                                           ("" "longtable" nil)
-                                           ("" "float" nil)
-                                           ("" "wrapfig" nil)
-                                           ("" "rotating" nil)
-                                           ("normalem" "ulem" t)
-                                           ("" "textcomp" t)
-                                           ("" "marvosym" t)
-                                           ("" "wasysym" t)
-                                           ("" "amssymb" t)
-                                           ("" "hyperref" nil)
-                                           "\\tolerance=1000")))
-
-(setq org-export-docbook-xslt-proc-command "xsltproc --output %o %s %i"
-      org-export-docbook-xsl-fo-proc-command "fop %i.safe %o"
-      org-export-docbook-xslt-stylesheet
-       "/usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl")
-
 ;; Glasses.
 
 (setq glasses-separator "-"
@@ -914,6 +801,122 @@ (setq display-buffer-fallback-action
           display-buffer-pop-up-window
           mdw-display-buffer-in-tolerable-window)))
 
+;;;--------------------------------------------------------------------------
+;;; Org-mode hacking.
+
+(defadvice org-agenda-list (around mdw-preserve-links activate)
+  (let ((mdw-diary-for-org-mode-p t))
+    ad-do-it))
+
+(defadvice org-bbdb-anniversaries (after mdw-fixup-list compile activate)
+  "Return a string rather than a list."
+  (with-temp-buffer
+    (let ((anyp nil))
+      (dolist (e (let ((ee ad-return-value))
+                  (if (atom ee) (list ee) ee)))
+       (when e
+         (when anyp (insert ?\n))
+         (insert e)
+         (setq anyp t)))
+      (setq ad-return-value
+             (and anyp (buffer-string))))))
+
+;; Fighting with Org-mode's evil key maps.
+
+(defcustom mdw-evil-keymap-keys
+  '(([S-up] . [?\C-c up])
+    ([S-down] . [?\C-c down])
+    ([S-left] . [?\C-c left])
+    ([S-right] . [?\C-c right])
+    (([M-up] [?\e up]) . [C-up])
+    (([M-down] [?\e down]) . [C-down])
+    (([M-left] [?\e left]) . [C-left])
+    (([M-right] [?\e right]) . [C-right]))
+  "Defines evil keybindings to clobber in `mdw-clobber-evil-keymap'.
+The value is an alist mapping evil keys (as a list, or singleton)
+to good keys (in the same form)."
+  :type '(alist :key-type (choice key-sequence (repeat key-sequence))
+               :value-type key-sequence))
+
+(defun mdw-clobber-evil-keymap (keymap)
+  "Replace evil key bindings in the KEYMAP.
+Evil key bindings are defined in `mdw-evil-keymap-keys'."
+  (dolist (entry mdw-evil-keymap-keys)
+    (let ((binding nil)
+         (keys (if (listp (car entry))
+                   (car entry)
+                 (list (car entry))))
+         (replacements (if (listp (cdr entry))
+                           (cdr entry)
+                         (list (cdr entry)))))
+      (catch 'found
+       (dolist (key keys)
+         (setq binding (lookup-key keymap key))
+         (when binding
+           (throw 'found nil))))
+      (when binding
+       (dolist (key keys)
+         (define-key keymap key nil))
+       (dolist (key replacements)
+         (define-key keymap key binding))))))
+
+(defcustom mdw-org-latex-defs
+  '(("strayman"
+     "\\documentclass{strayman}
+\\usepackage[utf8]{inputenc}
+\\usepackage[palatino, helvetica, courier, maths=cmr]{mdwfonts}
+\\usepackage{graphicx, tikz, mdwtab, mdwmath, crypto, longtable}"
+     ("\\section{%s}" . "\\section*{%s}")
+     ("\\subsection{%s}" . "\\subsection*{%s}")
+     ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
+     ("\\paragraph{%s}" . "\\paragraph*{%s}")
+     ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
+  "Additional LaTeX class definitions."
+  :type '(alist :key-type string
+               :value-type (list string
+                                 (alist :inline t
+                                        :key-type string
+                                        :value-type string))))
+
+(setq org-emphasis-regexp-components
+       '("- \t('\"{}"                  ; prematch
+         "- \t.,:!?;'\")}\\["          ; postmatch
+         " \t\r\n"                     ; /forbidden/ as border
+         "."                           ; body regexp
+         1))                           ; maximum newlines
+
+(setq org-entities-user
+       ;; NAME LATEX MATHP HTML ASCII LATIN1 UTF8
+       '(("relax" "" nil "" "" "" "")))
+
+(eval-after-load "org-latex"
+  '(setq org-export-latex-classes
+          (append mdw-org-latex-defs org-export-latex-classes)))
+
+(eval-after-load "ox-latex"
+  '(setq org-latex-classes (append mdw-org-latex-defs org-latex-classes)
+        org-latex-caption-above nil
+        org-latex-default-packages-alist '(("AUTO" "inputenc" t)
+                                           ("T1" "fontenc" t)
+                                           ("" "fixltx2e" nil)
+                                           ("" "graphicx" t)
+                                           ("" "longtable" nil)
+                                           ("" "float" nil)
+                                           ("" "wrapfig" nil)
+                                           ("" "rotating" nil)
+                                           ("normalem" "ulem" t)
+                                           ("" "textcomp" t)
+                                           ("" "marvosym" t)
+                                           ("" "wasysym" t)
+                                           ("" "amssymb" t)
+                                           ("" "hyperref" nil)
+                                           "\\tolerance=1000")))
+
+(setq org-export-docbook-xslt-proc-command "xsltproc --output %o %s %i"
+      org-export-docbook-xsl-fo-proc-command "fop %i.safe %o"
+      org-export-docbook-xslt-stylesheet
+       "/usr/share/xml/docbook/stylesheet/docbook-xsl/fo/docbook.xsl")
+
 ;;;--------------------------------------------------------------------------
 ;;; Improved compilation machinery.