diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2018-04-11 22:15:05 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2018-04-11 22:15:05 -0700 |
commit | c674c76012b5e634d6126275075bd8fe47b2448a (patch) | |
tree | 7f8eacebe33f688991551f4c772bd21a632d540c /.emacs.d/site-lisp | |
parent | 90be94a6cc5f0fbf37ed56ec38b763518d2496d2 (diff) | |
download | dotfiles-c674c76012b5e634d6126275075bd8fe47b2448a.tar.gz |
archive and delete some site-lisp
Diffstat (limited to '.emacs.d/site-lisp')
-rw-r--r-- | .emacs.d/site-lisp/anchored-transpose.el | 211 | ||||
-rw-r--r-- | .emacs.d/site-lisp/boxquote.el | 585 | ||||
-rw-r--r-- | .emacs.d/site-lisp/centered-window-mode.el | 103 | ||||
-rw-r--r-- | .emacs.d/site-lisp/hl-sentence.el | 105 | ||||
-rw-r--r-- | .emacs.d/site-lisp/message-templ.el | 396 | ||||
-rw-r--r-- | .emacs.d/site-lisp/org-mairix-el.el | 62 | ||||
-rw-r--r-- | .emacs.d/site-lisp/spw-pyblosxom.el | 142 |
7 files changed, 0 insertions, 1604 deletions
diff --git a/.emacs.d/site-lisp/anchored-transpose.el b/.emacs.d/site-lisp/anchored-transpose.el deleted file mode 100644 index 33af4f7e..00000000 --- a/.emacs.d/site-lisp/anchored-transpose.el +++ /dev/null @@ -1,211 +0,0 @@ -;;; anchored-transpose.el --- Transposes a phrase around an anchor phrase - -;; Copyright (C) 2004 Free Software Foundation, Inc. - -;; Author: Rick Bielawski <rbielaws@i1.net> -;; Keywords: tools convenience - -;; This file is free software; you can redistribute it and/or modify it under -;; the terms of the GNU General Public License as published by the Free -;; Software Foundation; either version 2, or (at your option) any later -;; version. - -;; This file is distributed in the hope that it will be useful, but WITHOUT -;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -;; more details. - -;;; Commentary: - -;; `anchored-transpose' is an interactive autoload function to transpose -;; portions of a region around an anchor phrase. In other words it swaps -;; two regions. -;; -;; See C-h f anchored-transpose <ret> for a complete description. - -;;; Installing: - -;; 1) Put anchored-transpose.el on your load path. -;; 2) Put the following 2 lines in your .emacs -;; (global-set-key [?\C-x ?t] 'anchored-transpose) -;; (autoload 'anchored-transpose "anchored-transpose" nil t) - -;;; History: - -;; 2004-09-24 RGB Seems useable enough to release. -;; 2004-10-15 RGB Only comments and doc strings were updated. -;; 2004-10-22 RGB Added support for 2 phrase selection. -;; 2004-12-01 RGB Added secondary selection support. -;; 2005-07-21 RGB Updated help text and comments. -;; Added support for A C B D and C A D B selection. -;; Fixed bug affecting multi line selections. -;; 2005-09-28 RGB Allow swapping regions with no anchor text between. -;; 2005-10-17 RGB Fix bug in fuzzy logic which turned off fuzziness. - -;;; Code: - -(defvar anchored-transpose-anchor () - "begin/end when `anchored-transpose' is in progress else nil") - -;;;###autoload -(defun anchored-transpose (beg1 end1 flg1 &optional beg2 end2 flg2) - "Transpose portions of the region around an anchor phrase. - -`this phrase but not that word' can be transposed into -`that word but not this phrase' - -I want this phrase but not that word. - |----------------------------|. .This is the entire phrase. - |-------|. . . . . . .This is the anchor phrase. - -First select the entire phrase and type \\[anchored-transpose]. Then select -the anchor phrase and type \\[anchored-transpose] again. By default the -anchor phrase will automatically include any surrounding whitespace even if -you don't explicitly select it. Also, it won't include certain trailing -punctuation. See `anchored-transpose-do-fuzzy' for details. A prefix arg -prior to either selection means `no fuzzy logic, use selections literally'. - -You can select the anchor phrase first followed by the entire phrase if more -convenient. Typing \\[anchored-transpose] with nothing selected clears any -prior selection. If both primary and secondary selections are active this -command swaps the 2 selections immediately. - -I want this phrase but not that word. - |----------| |---------| Separate phrase selection. - -You can also select the phrases to be swapped separately in any order. -" - (interactive `(,(region-beginning) ,(region-end) - ,current-prefix-arg - ,@anchored-transpose-anchor)) - (setq anchored-transpose-anchor nil deactivate-mark t) - (when (and mouse-secondary-overlay - mark-active - (eq (overlay-buffer mouse-secondary-overlay) - (current-buffer) - ) - (/= (overlay-start mouse-secondary-overlay) - (overlay-end mouse-secondary-overlay) - ) - ) - (setq beg2 (overlay-start mouse-secondary-overlay)) - (setq end2 (overlay-end mouse-secondary-overlay)) - (setq flg2 flg1) - (delete-overlay mouse-secondary-overlay) - ) - (if mark-active - (if end2 ; then both regions are marked. swap them. - (if (and (< beg1 beg2) ;A C B D - (< end1 end2) - (> end1 beg2)) - (apply 'anchored-transpose-swap - (anchored-transpose-do-fuzzy - beg1 beg2 end1 end2 flg1 flg2 flg1 flg2)) - (if (and (> beg1 beg2) ;C A D B - (> end1 end2) - (> end2 beg1)) - (apply 'anchored-transpose-swap - (anchored-transpose-do-fuzzy - beg2 beg1 end2 end1 flg2 flg1 flg2 flg1)) - (if (and (< beg1 beg2) ;A C D B - (> end1 end2)) - (apply 'anchored-transpose-swap - (anchored-transpose-do-fuzzy - beg1 beg2 end2 end1 flg1 flg2 flg2 flg1)) - (if (and (> beg1 beg2) ;C A B D - (< end1 end2)) - (apply 'anchored-transpose-swap - (anchored-transpose-do-fuzzy - beg2 beg1 end1 end2 flg2 flg1 flg1 flg2)) - (if (<= end1 beg2) ;A B C D - (apply 'anchored-transpose-swap - (anchored-transpose-do-fuzzy - beg1 end1 beg2 end2 flg1 flg1 flg2 flg2)) - (if (<= end2 beg1) ;C D A B - (apply 'anchored-transpose-swap - (anchored-transpose-do-fuzzy - beg2 end2 beg1 end1 flg2 flg2 flg1 flg1)) - (error "Regions have invalid overlap"))))))) - ;; 1st of 2 regions. Save it and wait for the other. - (setq anchored-transpose-anchor (list beg1 end1 flg1)) - (message "Select other part (anchor or region)")) - (error "Command requires a marked region"))) - -(defun anchored-transpose-do-fuzzy (r1beg r1end r2beg r2end - lit1 lit2 lit3 lit4) -"Returns the first 4 arguments after adjusting their value if necessary. - -I want this phrase but not that word. - |----------------------------|. .This is the entire phrase. - |-------|. . . . . . .This is the anchor phrase. - R1BEG R1END R2BEG R2END - -R1BEG and R1END define the first region and R2BEG and R2END the second. - -The flags, LIT1 thru LIT4 indicate if fuzzy logic should be applied to the -beginning of R1BEG, the end of R1END, the beginning of R2BEG, the end of R2END -respectively. If any flag is nil then fuzzy logic will be applied. Otherwise -the value passed should be returned LITerally (that is, unchanged). - -See `anchored-transpose-fuzzy-begin' and `anchored-transpose-fuzzy-end' for -specifics on what adjustments these routines will make when LITx is nil." - (list - (if lit1 r1beg - (anchored-transpose-fuzzy-begin r1beg r1end "[\t ]+")) - (if lit2 r1end - (anchored-transpose-fuzzy-end r1beg r1end "\\s +")) - (if lit3 r2beg - (anchored-transpose-fuzzy-begin r2beg r2end "[\t ]+")) - (if lit4 r2end - (anchored-transpose-fuzzy-end r2beg r2end "\\s *[.!?]")))) - -(defun anchored-transpose-fuzzy-end (beg end what) - "Returns END or new value for END based on the regexp WHAT. -BEG and END are buffer positions defining a region. If that region ends -with WHAT then the value for END is adjusted to exclude that matching text. - -NOTE: The regexp is applied differently than `looking-back' applies a regexp. - -Example: if (buffer-string beg end) contains `1234' the regexp `432' matches -it, not `234' as `looking-back' would. Also, your regexp never sees the char -at BEG so the match will always leave at least 1 character to transpose. -The reason for not using looking-back is that it's not greedy enough. -(looking-back \" +\") will only match one space no matter how many exist." - (let ((str (concat - (reverse (append (buffer-substring (1+ beg) end) nil))))) - (if (string-match (concat "\\`" what) str) - (- end (length (match-string 0 str))) - end))) - -(defun anchored-transpose-fuzzy-begin (beg end what) - "Returns BEG or a new value for BEG based on the regexp WHAT. -BEG and END are buffer positions defining a region. If the region begins -with WHAT then BEG is adjusted to exclude the matching text. - -NOTE: Your regexp never sees the last char defined by beg/end. This insures -at least 1 char is always left to transpose." - (let ((str (buffer-substring beg (1- end)))) - (if (string-match (concat "\\`" what) str) - (+ beg (length (match-string 0 str))) - beg))) - -(defun anchored-transpose-swap (r1beg r1end r2beg r2end) - "Swaps region r1beg/r1end with r2beg/r2end. Flags are currently ignored. -Point is left at r1end." - (let ((reg1 (buffer-substring r1beg r1end)) - (reg2 (delete-and-extract-region r2beg r2end))) - (goto-char r2beg) - (insert reg1) - (save-excursion ;; I want to leave point at the end of phrase 2. - (goto-char r1beg) - (delete-region r1beg r1end) - (insert reg2)))) - -(provide 'anchored-transpose) - -;; Because I like it this way. So there! -;;; Local Variables: *** -;;; fill-column:78 *** -;;; emacs-lisp-docstring-fill-column:78 *** -;;; End: *** -;;; anchored-transpose.el ends here. diff --git a/.emacs.d/site-lisp/boxquote.el b/.emacs.d/site-lisp/boxquote.el deleted file mode 100644 index 5c77790f..00000000 --- a/.emacs.d/site-lisp/boxquote.el +++ /dev/null @@ -1,585 +0,0 @@ -;;; boxquote.el --- Quote text with a semi-box. -;; Copyright 1999-2009 by Dave Pearson <davep@davep.org> -;; $Revision: 1.23 $ - -;; boxquote.el is free software distributed under the terms of the GNU -;; General Public Licence, version 2 or (at your option) any later version. -;; For details see the file COPYING. - -;;; Commentary: - -;; boxquote provides a set of functions for using a text quoting style that -;; partially boxes in the left hand side of an area of text, such a marking -;; style might be used to show externally included text or example code. -;; -;; ,---- -;; | The default style looks like this. -;; `---- -;; -;; A number of functions are provided for quoting a region, a buffer, a -;; paragraph and a defun. There are also functions for quoting text while -;; pulling it in, either by inserting the contents of another file or by -;; yanking text into the current buffer. -;; -;; The latest version of boxquote.el can be found at: -;; -;; <URL:http://www.davep.org/emacs/#boxquote.el> - -;;; Thanks: - -;; Kai Grossjohann for inspiring the idea of boxquote. I wrote this code to -;; mimic the "inclusion quoting" style in his Usenet posts. I could have -;; hassled him for his code but it was far more fun to write it myself. -;; -;; Mark Milhollan for providing a patch that helped me get the help quoting -;; functions working with XEmacs. -;; -;; Oliver Much for suggesting the idea of having a `boxquote-kill-ring-save' -;; function. -;; -;; Reiner Steib for suggesting `boxquote-where-is' and the idea of letting -;; `boxquote-describe-key' describe key bindings from other buffers. Also -;; thanks go to Reiner for suggesting `boxquote-insert-buffer'. - -;;; Code: - -;; Things we need: - -(eval-when-compile - (require 'cl)) -(require 'rect) - -;; Attempt to handle older/other emacs. -(eval-and-compile - - ;; If customize isn't available just use defvar instead. - (unless (fboundp 'defgroup) - (defmacro defgroup (&rest rest) nil) - (defmacro defcustom (symbol init docstring &rest rest) - `(defvar ,symbol ,init ,docstring))) - - ;; If `line-beginning-position' isn't available provide one. - (unless (fboundp 'line-beginning-position) - (defun line-beginning-position (&optional n) - "Return the `point' of the beginning of the current line." - (save-excursion - (beginning-of-line n) - (point)))) - - ;; If `line-end-position' isn't available provide one. - (unless (fboundp 'line-end-position) - (defun line-end-position (&optional n) - "Return the `point' of the end of the current line." - (save-excursion - (end-of-line n) - (point))))) - -;; Customize options. - -(defgroup boxquote nil - "Mark regions of text with a half-box." - :group 'editing - :prefix "boxquote-") - -(defcustom boxquote-top-and-tail "----" - "*Text that will be used at the top and tail of the box." - :type 'string - :group 'boxquote) - -(defcustom boxquote-top-corner "," - "*Text used for the top corner of the box." - :type 'string - :group 'boxquote) - -(defcustom boxquote-bottom-corner "`" - "*Text used for the bottom corner of the box." - :type 'string - :group 'boxquote) - -(defcustom boxquote-side "| " - "*Text used for the side of the box." - :type 'string - :group 'boxquote) - -(defcustom boxquote-title-format "[ %s ]" - "*Format string to use when creating a box title." - :type 'string - :group 'boxquote) - -(defcustom boxquote-title-files t - "*Should a `boxquote-insert-file' title the box with the file name?" - :type '(choice - (const :tag "Title the box with the file name" t) - (const :tag "Don't title the box with the file name" nil)) - :group 'boxquote) - -(defcustom boxquote-file-title-function #'file-name-nondirectory - "*Function to apply to a file's name when using it to title a box." - :type 'function - :group 'boxquote) - -(defcustom boxquote-title-buffers t - "*Should a `boxquote-insert-buffer' title the box with the buffer name?" - :type '(choice - (const :tag "Title the box with the buffer name" t) - (const :tag "Don't title the box with the buffer name" nil)) - :group 'boxquote) - -(defcustom boxquote-buffer-title-function #'identity - "*Function to apply to a buffer's name when using it to title a box." - :type 'function - :group 'boxquote) - -(defcustom boxquote-region-hook nil - "*Hooks to perform when on a region prior to boxquoting. - -Note that all forms of boxquoting use `boxquote-region' to create the -boxquote. Because of this any hook you place here will be invoked by any of -the boxquoting functions." - :type 'hook - :group 'boxquote) - -(defcustom boxquote-yank-hook nil - "*Hooks to perform on the yanked text prior to boxquoting." - :type 'hook - :group 'boxquote) - -(defcustom boxquote-insert-file-hook nil - "*Hooks to perform on the text from an inserted file prior to boxquoting." - :type 'hook - :group 'boxquote) - -(defcustom boxquote-kill-ring-save-title #'buffer-name - "*Function for working out the title for a `boxquote-kill-ring-save'. - -The string returned from this function will be used as the title for a -boxquote when the saved text is yanked into a buffer with \\[boxquote-yank]. - -An example of a non-trivial value for this variable might be: - - (lambda () - (if (string= mode-name \"Article\") - (aref gnus-current-headers 4) - (buffer-name))) - -In this case, if you are a `gnus' user, \\[boxquote-kill-ring-save] could be -used to copy text from an article buffer and, when it is yanked into another -buffer using \\[boxquote-yank], the title of the boxquote would be the ID of -the article you'd copied the text from." - :type 'function - :group 'boxquote) - -(defcustom boxquote-describe-function-title-format "C-h f %s RET" - "*Format string to use when formatting a function description box title" - :type 'string - :group 'boxquote) - -(defcustom boxquote-describe-variable-title-format "C-h v %s RET" - "*Format string to use when formatting a variable description box title" - :type 'string - :group 'boxquote) - -(defcustom boxquote-describe-key-title-format "C-h k %s" - "*Format string to use when formatting a key description box title" - :type 'string - :group 'boxquote) - -(defcustom boxquote-where-is-title-format "C-h w %s RET" - "*Format string to use when formatting a `where-is' description box title" - :type 'string - :group 'boxquote) - -(defcustom boxquote-where-is-body-format "%s is on %s" - "*Format string to use when formatting a `where-is' description." - :type 'string - :group 'boxquote) - -;; Main code: - -(defun boxquote-xemacs-p () - "Are we running in XEmacs?" - (and (boundp 'running-xemacs) (symbol-value 'running-xemacs))) - -(defun boxquote-points () - "Find the start and end points of a boxquote. - -If `point' is inside a boxquote then a cons is returned, the `car' is the -start `point' and the `cdr' is the end `point'. NIL is returned if no -boxquote is found." - (save-excursion - (beginning-of-line) - (let* ((re-top (concat "^" (regexp-quote boxquote-top-corner) - (regexp-quote boxquote-top-and-tail))) - (re-left (concat "^" (regexp-quote boxquote-side))) - (re-bottom (concat "^" (regexp-quote boxquote-bottom-corner) - (regexp-quote boxquote-top-and-tail))) - (points - (flet ((find-box-end (re &optional back) - (save-excursion - (when (if back - (search-backward-regexp re nil t) - (search-forward-regexp re nil t)) - (point))))) - (cond ((looking-at re-top) - (cons (point) (find-box-end re-bottom))) - ((looking-at re-left) - (cons (find-box-end re-top t) (find-box-end re-bottom))) - ((looking-at re-bottom) - (cons (find-box-end re-top t) (line-end-position))))))) - (when (and (car points) (cdr points)) - points)))) - -(defun boxquote-quoted-p () - "Is `point' inside a boxquote?" - (not (null (boxquote-points)))) - -(defun boxquote-points-with-check () - "Get the `boxquote-points' and flag an error of no box was found." - (or (boxquote-points) (error "I can't see a box here"))) - -(defun boxquote-title-format-as-regexp () - "Return a regular expression to match the title." - (with-temp-buffer - (insert (regexp-quote boxquote-title-format)) - (setf (point) (point-min)) - (when (search-forward "%s" nil t) - (replace-match ".*" nil t)) - (buffer-string))) - -(defun boxquote-get-title () - "Get the title for the current boxquote." - (multiple-value-bind (prefix-len suffix-len) - (with-temp-buffer - (let ((look-for "%s")) - (insert boxquote-title-format) - (setf (point) (point-min)) - (search-forward look-for) - (list (- (point) (length look-for) 1) (- (point-max) (point))))) - (save-excursion - (save-restriction - (boxquote-narrow-to-boxquote) - (setf (point) (+ (point-min) - (length (concat boxquote-top-corner - boxquote-top-and-tail)))) - (if (looking-at (boxquote-title-format-as-regexp)) - (buffer-substring-no-properties (+ (point) prefix-len) - (- (line-end-position) suffix-len)) - ""))))) - -;;;###autoload -(defun boxquote-title (title) - "Set the title of the current boxquote to TITLE. - -If TITLE is an empty string the title is removed. Note that the title will -be formatted using `boxquote-title-format'." - (interactive (list (read-from-minibuffer "Title: " (boxquote-get-title)))) - (save-excursion - (save-restriction - (boxquote-narrow-to-boxquote) - (setf (point) (+ (point-min) - (length (concat boxquote-top-corner - boxquote-top-and-tail)))) - (unless (eolp) - (kill-line)) - (unless (zerop (length title)) - (insert (format boxquote-title-format title)))))) - -;;;###autoload -(defun boxquote-region (start end) - "Draw a box around the left hand side of a region bounding START and END." - (interactive "r") - (save-excursion - (save-restriction - (flet ((bol-at-p (n) - (setf (point) n) - (bolp)) - (insert-corner (corner pre-break) - (insert (concat (if pre-break "\n" "") - corner boxquote-top-and-tail "\n")))) - (let ((break-start (not (bol-at-p start))) - (break-end (not (bol-at-p end)))) - (narrow-to-region start end) - (run-hooks 'boxquote-region-hook) - (setf (point) (point-min)) - (insert-corner boxquote-top-corner break-start) - (let ((start-point (line-beginning-position))) - (setf (point) (point-max)) - (insert-corner boxquote-bottom-corner break-end) - (string-rectangle start-point - (progn - (setf (point) (point-max)) - (forward-line -2) - (line-beginning-position)) - boxquote-side))))))) - -;;;###autoload -(defun boxquote-buffer () - "Apply `boxquote-region' to a whole buffer." - (interactive) - (boxquote-region (point-min) (point-max))) - -;;;###autoload -(defun boxquote-insert-file (filename) - "Insert the contents of a file, boxed with `boxquote-region'. - -If `boxquote-title-files' is non-nil the boxquote will be given a title that -is the result of applying `boxquote-file-title-function' to FILENAME." - (interactive "fInsert file: ") - (insert (with-temp-buffer - (insert-file-contents filename nil) - (run-hooks 'boxquote-insert-file-hook) - (boxquote-buffer) - (when boxquote-title-files - (boxquote-title (funcall boxquote-file-title-function filename))) - (buffer-string)))) - -;;;###autoload -(defun boxquote-insert-buffer (buffer) - "Insert the contents of a buffer, boxes with `boxquote-region'. - -If `boxquote-title-buffers' is non-nil the boxquote will be given a title that -is the result of applying `boxquote-buffer-title-function' to BUFFER." - (interactive "bInsert Buffer: ") - (boxquote-text - (with-current-buffer buffer - (buffer-substring-no-properties (point-min) (point-max)))) - (when boxquote-title-buffers - (boxquote-title (funcall boxquote-buffer-title-function buffer)))) - -;;;###autoload -(defun boxquote-kill-ring-save () - "Like `kill-ring-save' but remembers a title if possible. - -The title is acquired by calling `boxquote-kill-ring-save-title'. The title -will be used by `boxquote-yank'." - (interactive) - (call-interactively #'kill-ring-save) - (setf (car kill-ring-yank-pointer) - (format "%S" (list - 'boxquote-yank-marker - (funcall boxquote-kill-ring-save-title) - (car kill-ring-yank-pointer))))) - -;;;###autoload -(defun boxquote-yank () - "Do a `yank' and box it in with `boxquote-region'. - -If the yanked entry was placed on the kill ring with -`boxquote-kill-ring-save' the resulting boxquote will be titled with -whatever `boxquote-kill-ring-save-title' returned at the time." - (interactive) - (save-excursion - (insert (with-temp-buffer - (yank) - (setf (point) (point-min)) - (let ((title - (let ((yanked (condition-case nil - (read (current-buffer)) - (error nil)))) - (when (listp yanked) - (when (eq (car yanked) 'boxquote-yank-marker) - (setf (buffer-string) (nth 2 yanked)) - (nth 1 yanked)))))) - (run-hooks 'boxquote-yank-hook) - (boxquote-buffer) - (when title - (boxquote-title title)) - (buffer-string)))))) - -;;;###autoload -(defun boxquote-defun () - "Apply `boxquote-region' the current defun." - (interactive) - (mark-defun) - (boxquote-region (region-beginning) (region-end))) - -;;;###autoload -(defun boxquote-paragraph () - "Apply `boxquote-region' to the current paragraph." - (interactive) - (mark-paragraph) - (boxquote-region (region-beginning) (region-end))) - -;;;###autoload -(defun boxquote-boxquote () - "Apply `boxquote-region' to the current boxquote." - (interactive) - (let ((box (boxquote-points-with-check))) - (boxquote-region (car box) (1+ (cdr box))))) - -(defun boxquote-help-buffer-name (item) - "Return the name of the help buffer associated with ITEM." - (if (boxquote-xemacs-p) - (loop for buffer in (symbol-value 'help-buffer-list) - when (string-match (concat "^*Help:.*`" item "'") buffer) - return buffer) - "*Help*")) - -(defun boxquote-quote-help-buffer (help-call title-format item) - "Perform a help command and boxquote the output. - -HELP-CALL is a function that calls the help command. - -TITLE-FORMAT is the `format' string to use to product the boxquote title. - -ITEM is a function for retrieving the item to get help on." - (let ((one-window-p (one-window-p))) - (boxquote-text - (save-window-excursion - (funcall help-call) - (with-current-buffer (boxquote-help-buffer-name (funcall item)) - (buffer-substring-no-properties (point-min) (point-max))))) - (boxquote-title (format title-format (funcall item))) - (when one-window-p - (delete-other-windows)))) - -;;;###autoload -(defun boxquote-describe-function () - "Call `describe-function' and boxquote the output into the current buffer." - (interactive) - (boxquote-quote-help-buffer - #'(lambda () - (call-interactively #'describe-function)) - boxquote-describe-function-title-format - #'(lambda () - (car (if (boxquote-xemacs-p) - (symbol-value 'function-history) - minibuffer-history))))) - -;;;###autoload -(defun boxquote-describe-variable () - "Call `describe-variable' and boxquote the output into the current buffer." - (interactive) - (boxquote-quote-help-buffer - #'(lambda () - (call-interactively #'describe-variable)) - boxquote-describe-variable-title-format - #'(lambda () - (car (if (boxquote-xemacs-p) - (symbol-value 'variable-history) - minibuffer-history))))) - -;;;###autoload -(defun boxquote-describe-key (key) - "Call `describe-key' and boxquote the output into the current buffer. - -If the call to this command is prefixed with \\[universal-argument] you will also be -prompted for a buffer. The key defintion used will be taken from that buffer." - (interactive "kDescribe key: ") - (let ((from-buffer (if current-prefix-arg - (read-buffer "Buffer: " (current-buffer) t) - (current-buffer)))) - (let ((binding - (with-current-buffer from-buffer - (key-binding key)))) - (if (or (null binding) (integerp binding)) - (message "%s is undefined" (with-current-buffer from-buffer - (key-description key))) - (boxquote-quote-help-buffer - #'(lambda () - (with-current-buffer from-buffer - (describe-key key))) - boxquote-describe-key-title-format - #'(lambda () - (with-current-buffer from-buffer - (key-description key)))))))) - -;;;###autoload -(defun boxquote-shell-command (command) - "Call `shell-command' with COMMAND and boxquote the output." - (interactive (list (read-from-minibuffer "Shell command: " nil nil nil 'shell-command-history))) - (boxquote-text (with-temp-buffer - (shell-command command t) - (buffer-string))) - (boxquote-title command)) - -;;;###autoload -(defun boxquote-where-is (definition) - "Call `where-is' with DEFINITION and boxquote the result." - (interactive "CCommand: ") - (boxquote-text (with-temp-buffer - (where-is definition t) - (format boxquote-where-is-body-format definition (buffer-string)))) - (boxquote-title (format boxquote-where-is-title-format definition))) - -;;;###autoload -(defun boxquote-text (text) - "Insert TEXT, boxquoted." - (interactive "sText: ") - (save-excursion - (unless (bolp) - (insert "\n")) - (insert - (with-temp-buffer - (insert text) - (boxquote-buffer) - (buffer-string))))) - -;;;###autoload -(defun boxquote-narrow-to-boxquote () - "Narrow the buffer to the current boxquote." - (interactive) - (let ((box (boxquote-points-with-check))) - (narrow-to-region (car box) (cdr box)))) - -;;;###autoload -(defun boxquote-narrow-to-boxquote-content () - "Narrow the buffer to the content of the current boxquote." - (interactive) - (let ((box (boxquote-points-with-check))) - (narrow-to-region (save-excursion - (setf (point) (car box)) - (forward-line 1) - (point)) - (save-excursion - (setf (point) (cdr box)) - (line-beginning-position))))) - -;;;###autoload -(defun boxquote-kill () - "Kill the boxquote and its contents." - (interactive) - (let ((box (boxquote-points-with-check))) - (kill-region (car box) (1+ (cdr box))))) - -;;;###autoload -(defun boxquote-fill-paragraph (arg) - "Perform a `fill-paragraph' inside a boxquote." - (interactive "P") - (if (boxquote-quoted-p) - (save-restriction - (boxquote-narrow-to-boxquote-content) - (let ((fill-prefix boxquote-side)) - (fill-paragraph arg))) - (fill-paragraph arg))) - -;;;###autoload -(defun boxquote-unbox-region (start end) - "Remove a box created with `boxquote-region'." - (interactive "r") - (save-excursion - (save-restriction - (narrow-to-region start end) - (setf (point) (point-min)) - (if (looking-at (concat "^" (regexp-quote boxquote-top-corner) - (regexp-quote boxquote-top-and-tail))) - (let ((ends (concat "^[" (regexp-quote boxquote-top-corner) - (regexp-quote boxquote-bottom-corner) - "]" boxquote-top-and-tail)) - (lines (concat "^" (regexp-quote boxquote-side)))) - (loop while (< (point) (point-max)) - if (looking-at ends) do (kill-line t) - if (looking-at lines) do (delete-char 2) - do (forward-line))) - (error "I can't see a box here"))))) - -;;;###autoload -(defun boxquote-unbox () - "Remove the boxquote that contains `point'." - (interactive) - (let ((box (boxquote-points-with-check))) - (boxquote-unbox-region (car box) (1+ (cdr box))))) - -(provide 'boxquote) - -;;; boxquote.el ends here. diff --git a/.emacs.d/site-lisp/centered-window-mode.el b/.emacs.d/site-lisp/centered-window-mode.el deleted file mode 100644 index e5eafac3..00000000 --- a/.emacs.d/site-lisp/centered-window-mode.el +++ /dev/null @@ -1,103 +0,0 @@ -;;; centered-window-mode.el --- Center the text when there's only one window -;; -;; Copyright (C) 2014 Anler Hp <http://anler.me> -;; -;; Author: Anler Hp <http://anler.me> -;; Version: 0.0.1 -;; Keywords: faces, windows -;; URL: https://github.com/ikame/centered-window-mode -;; Compatibility: GNU Emacs 23.x, GNU Emacs 24.x -;; -;; This file is NOT part of GNU Emacs. -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License -;; as published by the Free Software Foundation; either version 2 -;; of the License, or (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see <http://www.gnu.org/licenses/>. -;; -;;; Commentary: -;; -;; Enable centered-window-mode and your text is going to be centered when there's -;; only one window in the frame. -;; -;;; Changes Log: -;; -;;; Code: - -(defvar fringe-background nil "The background color used for the fringe") - -(defadvice switch-to-buffer (after cwm/switch-to-buffer activate) - (cwm/window-configuration-change)) - -(defun cwm/setup () - (add-hook 'window-configuration-change-hook - 'cwm/window-configuration-change - nil - t) - (cwm/window-configuration-change)) - -(defun cwm/teardown () - (remove-hook 'window-configuration-change-hook - 'cwm/window-configuration-change - t) - (cwm/window-configuration-change)) - -(defadvice split-window-right (before cwm/reset-on-split activate) - "Disable cwm-mode presentation (if active) before splitting window" - (when fringe-mode - (cwm/reset))) - -(defadvice load-theme (after cwm/set-faces-on-load-theme activate) - "Change the default fringe background whenever the theme changes" - (message "load theme after here") - (cwm/update-fringe-background)) - -(defun cwm/window-configuration-change () - (if (or (> (length (window-list)) 1) - (null centered-window-mode)) - (cwm/reset) - (cwm/center))) - -(defun cwm/center () - (set-window-fringes - nil - (/ (- (frame-pixel-width) - (* 110 (frame-char-width))) - 2))) - -(defun cwm/reset () - (set-window-fringes nil nil)) - -(defun cwm/set-faces () - (custom-set-faces - `(fringe ((t (:background ,fringe-background)))))) - -(defun cwm/update-fringe-background () - (setq fringe-background (cwm/get-fringe-background)) - (cwm/set-faces)) - -(defun cwm/get-fringe-background () - (face-attribute 'default :background)) - -(cwm/update-fringe-background) - -;;;###autoload -(define-minor-mode centered-window-mode - "Minor mode to cwm on the current buffer." - :init-value nil - :lighter " ⌗" - (if centered-window-mode - (cwm/setup) - (cwm/teardown))) - -(provide 'centered-window-mode) - -;;; centered-window-mode.el ends here diff --git a/.emacs.d/site-lisp/hl-sentence.el b/.emacs.d/site-lisp/hl-sentence.el deleted file mode 100644 index 2362ff3f..00000000 --- a/.emacs.d/site-lisp/hl-sentence.el +++ /dev/null @@ -1,105 +0,0 @@ -;;; hl-sentence.el --- highlight a sentence based on customizable face - -;; Copyright (c) 2011 Donald Ephraim Curtis - -;; Author: Donald Ephraim Curtis <dcurtis@milkbox.net> -;; URL: http://github.com/milkypostman/hl-sentence -;; Version: 3 -;; Keywords: highlighting - -;; This file is not part of GNU Emacs. - -;;; License: - -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License -;; as published by the Free Software Foundation; either version 3 -;; of the License, or (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -;; Boston, MA 02110-1301, USA. - -;;; Commentary: -;; -;; Highlight the current sentence using `hl-sentence-face'. -;; -;; To use this package, add the following code to your `emacs-init-file' -;; -;; (require 'hl-sentence) -;; (add-hook 'YOUR-MODE-HOOK 'hl-sentence-mode) -;; (set-face-attribute 'hl-sentence-face nil -;; :foreground "#444") -;; -;; Please send bug reports to -;; https://github.com/milkypostman/hl-sentence/issues -;; -;; This mode started out as a bit of elisp at -;; http://www.emacswiki.org/emacs/SentenceHighlight by Aaron Hawley. - -;;; Code: -(defgroup hl-sentence nil - "Highlight the current sentence." - :group 'convenience) - -;;;###autoload -(defface hl-sentence-face - '((t)) - "The face used to highlight the current sentence." - :group 'hl-sentence) - -(defun hl-sentence-begin-pos () - "Return the point of the beginning of a sentence." - (save-excursion - (unless (= (point) (point-max)) - (forward-char)) - (backward-sentence) - (point))) - -(defun hl-sentence-end-pos () - "Return the point of the end of a sentence." - (save-excursion - (unless (= (point) (point-max)) - (forward-char)) - (backward-sentence) - (forward-sentence) - (point))) - -(defvar hl-sentence-extent nil - "The location of the hl-sentence-mode overlay.") - -;;;###autoload -(define-minor-mode hl-sentence-mode - "Enable highlighting of currentent sentence." - :init-value nil - (progn - (if hl-sentence-mode - (add-hook 'post-command-hook 'hl-sentence-current nil t) - (move-overlay hl-sentence-extent 0 0 (current-buffer)) - (remove-hook 'post-command-hook 'hl-sentence-current t)))) - -(defun hl-sentence-current () - "Highlight current sentence." - (and hl-sentence-mode (> (buffer-size) 0) - (progn - (and (boundp 'hl-sentence-extent) - hl-sentence-extent - (move-overlay hl-sentence-extent - (hl-sentence-begin-pos) - (hl-sentence-end-pos) - (current-buffer)))))) - -(setq hl-sentence-extent (make-overlay 0 0)) -(overlay-put hl-sentence-extent 'face 'hl-sentence-face) - - - -(provide 'hl-sentence) - -;;; hl-sentence.el ends here diff --git a/.emacs.d/site-lisp/message-templ.el b/.emacs.d/site-lisp/message-templ.el deleted file mode 100644 index 17f95ac0..00000000 --- a/.emacs.d/site-lisp/message-templ.el +++ /dev/null @@ -1,396 +0,0 @@ -;;; message-templ.el --- Templates for message-mode. - -;; Copyright (C) 1998,1999,2000 Masahiro MURATA <muse@ba2.so-net.ne.jp> -;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org> -;; Copyright (C) 2004 ARISAWA Akihiro <ari@mbf.sphere.ne.jp> - -;; Author: ARISAWA Akihiro <ari@mbf.sphere.ne.jp> -;; Keywords: mail, news, template -;; Version: 0.3.20161104 -;; Maintainer: David Bremner <david@tethera.net> -;; URL: git://pivot.cs.unb.ca/message-templ.git - -;; This file is not part of GNU Emacs. - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. -;; - -;;; Commentary: - -;; This package is a port of the Wanderlust template facility to -;; message-mode, the message composition mode used by e.g. Gnus, -;; notmuch-emacs, and mu4e. - -;;; Code: - -(require 'message) -(autoload 'article-display-x-face "gnus-art" nil t) - -(defgroup message-temp nil - "Template for message composing." - :group 'message) - -(defcustom message-templ-alist nil - "Alist of template. -First element of each list is a string specifies the name of the template. -Remaining elements indicate actions." - :type '(repeat (list (string :tag "Name") - (repeat - :inline t - (choice (cons (sexp :tag "Field(Variable)") - (sexp :tag "Value")) - (sexp :tag "Function"))))) - :group 'message-templ) - -(defcustom message-templ-config-alist nil - "Alist of actions to apply -First element of each list is a regex which triggers the action if matched. -Remaining elements indicate actions." - :type '(repeat (list (string :tag "Header Regex") - (repeat - :inline t - (choice (string :tag "Template") - (cons (sexp :tag "Field(Variable)") - (sexp :tag "Value")) - (sexp :tag "Function"))))) - :group 'message-templ) - -(defcustom message-templ-visible-select t - "*If non-nil, select template with visible." - :type 'boolean - :group 'message-templ) - -(defcustom message-templ-confirm nil - "*If non-nil, require your confirmation when selected template." - :type 'boolean - :group 'message-templ) - -(defcustom message-templ-buffer-lines 7 - "*Lines of template buffer." - :type 'integer - :group 'message-templ) - -(defvar message-templ-default-name "default") -(defvar message-templ-buffer-name "*Message-Template*") -(defvar message-templ-mode-map nil) - -(defvar message-templ nil) -(defvar message-templ-cur-num 0) -(defvar message-templ-max-num 0) -(defvar message-templ-draft-buffer nil) -(defvar message-templ-preview nil) -(defvar message-templ-config-variables nil) - -(defvar message-templ-config-sub-function-alist - '((body . message-templ-config-sub-body) - (top . message-templ-config-sub-top) - (bottom . message-templ-config-sub-bottom) - (header . message-templ-config-sub-header) - (header-top . message-templ-config-sub-header-top) - (header-bottom . message-templ-config-sub-header) -; (part-top . message-templ-config-sub-part-top) -; (part-bottom . message-templ-config-sub-part-bottom) - (body-file . message-templ-config-sub-body-file) - (top-file . message-templ-config-sub-top-file) - (bottom-file . message-templ-config-sub-bottom-file) - (header-file . message-templ-config-sub-header-file) - (template . message-templ-config-sub-template) - (x-face . message-templ-config-sub-x-face))) - -(unless message-templ-mode-map - (setq message-templ-mode-map (make-sparse-keymap)) - (define-key message-templ-mode-map "p" 'message-templ-prev) - (define-key message-templ-mode-map "n" 'message-templ-next) - (define-key message-templ-mode-map "q" 'message-templ-abort) - (define-key message-templ-mode-map "\r" 'message-templ-set) - (define-key message-templ-mode-map "\n" 'message-templ-set)) - -(defsubst message-templ-config-sub-eval-insert (content &optional newline) - (let (content-value) - (when (and content - (stringp (setq content-value (eval content)))) - (insert content-value) - (when newline (insert "\n"))))) - -(defun message-templ-config-sub-body (content) - (message-goto-body) - (delete-region (point) (point-max)) - (message-templ-config-sub-eval-insert content)) - -(defun message-templ-config-sub-top (content) - (message-goto-body) - (message-templ-config-sub-eval-insert content)) - -(defun message-templ-config-sub-bottom (content) - (goto-char (point-max)) - (message-templ-config-sub-eval-insert content)) - -(defun message-templ-config-sub-header (content) - (message-goto-eoh) - (message-templ-config-sub-eval-insert content 'newline)) - -(defun message-templ-config-sub-header-top (content) - (goto-char (point-min)) - (message-templ-config-sub-eval-insert content 'newline)) - -;(defun message-templ-config-sub-part-top (content) -; (goto-char (mime-edit-content-beginning)) -; (message-templ-config-sub-eval-insert content 'newline)) - -;(defun message-templ-config-sub-part-bottom (content) -; (goto-char (mime-edit-content-end)) -; (message-templ-config-sub-eval-insert content 'newline)) - -(defsubst message-templ-config-sub-file (content) - (let ((coding-system-for-read 'undecided) - (file (expand-file-name (eval content)))) - (if (file-exists-p file) - (insert-file-contents file) - (error "%s: no exists file" file)))) - -(defun message-templ-config-sub-body-file (content) - (message-goto-body) - (delete-region (point) (point-max)) - (message-templ-config-sub-file content)) - -(defun message-templ-config-sub-top-file (content) - (message-goto-body) - (message-templ-config-sub-file content)) - -(defun message-templ-config-sub-bottom-file (content) - (goto-char (point-max)) - (message-templ-config-sub-file content)) - -(defun message-templ-config-sub-header-file (content) - (message-goto-eoh) - (message-templ-config-sub-file content)) - -(defun message-templ-config-sub-template (content) - (setq message-templ-config-variables - (message-templ-insert (eval content)))) - -(defun message-templ-config-sub-x-face (content) - (save-restriction - (message-narrow-to-headers) - (message-remove-header "X-Face")) - (message-position-on-field "X-Face" "From") - (nnheader-insert-file-contents content)) - -(defun message-templ-config-sub-function (field content) - (let (func) - (when (setq func (assq field message-templ-config-sub-function-alist)) - (let (message-templ-config-variables) - (funcall (cdr func) content) - ;; for message-templ-config-sub-template - (cons t message-templ-config-variables))))) - -(defun message-templ-config-exec-sub (clist) - (let (config local-variables) - (while clist - (setq config (car clist)) - (cond - ((stringp config) - (message-templ-apply config)) - ((functionp config) - (funcall config)) - ((consp config) - (let ((field (car config)) - (content (cdr config)) - ret-val) - (cond - ((stringp field) - (save-restriction - (message-narrow-to-headers) - (message-remove-header field)) - (message-position-on-field field) - (insert (eval content))) - ((setq ret-val (message-templ-config-sub-function field content)) - (when (cdr ret-val) ;; for message-templ-config-sub-template - (setq local-variables (nconc local-variables (cdr ret-val))))) - ((boundp field) ;; variable - (make-local-variable field) - (set field (eval content)) - (setq local-variables (nconc local-variables (list field)))) - (t - (error "%s: not variable" field))))) - (t - (error "%s: not supported type" config))) - (setq clist (cdr clist))) - local-variables)) - -(defun message-templ-preview-p () - "Return non-nil when preview template." - message-templ-preview) - -(defun message-templ-apply (name) - "Apply NAME template to draft." - (let (template) - (when name - (when (string= name "") - (setq name message-templ-default-name)) - (when (setq template (cdr (assoc name message-templ-alist))) - (save-excursion - (message-templ-config-exec-sub template)))))) - -(defun message-templ-mode () - "Major mode for message template. - -\\{message-templ-mode} - -Entering Message-Templ mode calls the value of `message-templ-mode-hook'." - (kill-all-local-variables) - (setq mode-name "Message-Templ" - major-mode 'message-templ-mode) - (use-local-map message-templ-mode-map) - (set (make-local-variable 'font-lock-defaults) - '(message-font-lock-keywords t)) - (setq buffer-read-only t) - (run-hooks 'message-templ-mode-hook)) - -;;;###autoload -(defun message-templ-select (&optional arg) - "Select template from `message-templ-alist'." - (interactive "P") - (if (not (if arg - (not message-templ-visible-select) - message-templ-visible-select)) - (message-templ-apply - (completing-read (format "Template (%s): " message-templ-default-name) - message-templ-alist)) - (let* ((begin message-templ-default-name) - (work message-templ-alist)) - (when (and begin (cdr (assoc begin message-templ-alist))) - (while (not (string= (car (car work)) begin)) - (setq message-templ-cur-num (1+ message-templ-cur-num)) - (setq work (cdr work)))) - (setq message-templ nil - message-templ-cur-num 0 - message-templ-max-num (length message-templ-alist)) - (setq message-templ-draft-buffer (current-buffer)) - (if (get-buffer-window message-templ-buffer-name) - (select-window (get-buffer-window message-templ-buffer-name)) - (let* ((cur-win (selected-window)) - (size (min - (- (window-height cur-win) - window-min-height 1) - (- (window-height cur-win) - (max window-min-height - (1+ message-templ-buffer-lines)))))) - (split-window cur-win (if (> size 0) size window-min-height)) - ;; goto the bottom of the two... - (select-window (next-window)) - ;; make it display... - (let ((pop-up-windows nil)) - (switch-to-buffer (get-buffer-create message-templ-buffer-name))))) - (set-buffer message-templ-buffer-name) - (message-templ-mode) - (message-templ-show)))) - -(defun message-templ-show (&optional arg) - "Show reference INDEX in `message-templ-alist'. -vARG is ignored." ; ARG ignored this version (?) - (save-excursion - (set-buffer message-templ-buffer-name) - (let ((buffer-read-only nil) - (message-templ-preview t) - (mail-header-separator "--header separater--")) - (erase-buffer) - (goto-char (point-min)) - (message-templ-insert - (setq message-templ - (car (nth message-templ-cur-num message-templ-alist))) - mail-header-separator) - (let ((gnus-article-buffer (current-buffer))) - (article-display-x-face)) - (setq mode-line-process (concat ":" message-templ)) - (set-buffer-modified-p nil)))) - -(defun message-templ-next () - "Display next reference in other buffer." - (interactive) - (when (= message-templ-max-num - (setq message-templ-cur-num (1+ message-templ-cur-num))) - (setq message-templ-cur-num 0)) - (message-templ-show)) - -(defun message-templ-prev () - "Display previous reference in other buffer." - (interactive) - (setq message-templ-cur-num (if (zerop message-templ-cur-num) - (1- message-templ-max-num) - (1- message-templ-cur-num))) - (message-templ-show)) - -(defun message-templ-abort () - "Exit from electric reference mode without inserting reference." - (interactive) - (setq message-templ nil) - (delete-window) - (kill-buffer message-templ-buffer-name) - (when (buffer-live-p message-templ-draft-buffer) - (set-buffer message-templ-draft-buffer) - (let ((win (get-buffer-window message-templ-draft-buffer))) - (when win (select-window win))))) - -(defun message-templ-set () - "Exit from electric reference mode and insert selected reference." - (interactive) - (if (and message-templ-confirm - (not (y-or-n-p "Are you sure ? "))) - (message "") - (delete-window) - (kill-buffer message-templ-buffer-name) - (when (buffer-live-p message-templ-draft-buffer) - (set-buffer message-templ-draft-buffer) - (message-templ-apply message-templ) - (let ((win (get-buffer-window message-templ-draft-buffer))) - (when win (select-window win)))))) - -(defun message-templ-insert (name &optional mail-header) - "Insert NAME template. -Set header-separator is MAIL-HEADER." - (let ((template (cdr (assoc name message-templ-alist))) - (mail-header-separator (or mail-header - mail-header-separator))) - (when template - (when mail-header - (insert mail-header-separator "\n")) - (message-templ-config-exec-sub template)))) - -;;;###autoload -(defun message-templ-config-exec (&optional config-alist) - "Change headers according to the value of `message-templ-config-alist'." - (interactive) - (let ((case-fold-search t) - (alist (or config-alist message-templ-config-alist)) - local-variables key clist found) - (save-excursion - (while alist - (setq key (caar alist) - clist (cdar alist)) - (cond - ((stringp key) - (if (save-restriction - (message-narrow-to-headers) - (goto-char (point-min)) - (re-search-forward key nil t)) - (message-templ-config-exec-sub clist))) - ((eval key) - (message-templ-config-exec-sub clist))) - (setq alist (cdr alist)))))) - -(provide 'message-templ) -;;; message-templ.el ends here diff --git a/.emacs.d/site-lisp/org-mairix-el.el b/.emacs.d/site-lisp/org-mairix-el.el deleted file mode 100644 index 3f4d4c3d..00000000 --- a/.emacs.d/site-lisp/org-mairix-el.el +++ /dev/null @@ -1,62 +0,0 @@ -;;; org-mairix-el.el --- create Org links to mairix.el searches - -;; Copyright (C) 2014 Sean Whitton - -;; Author: Sean Whitton <spw@sdf.org> -;; Keywords: mail - -;; This file is free software; you can redistribute it and/or modify it under -;; the terms of the GNU General Public License as published by the Free -;; Software Foundation; either version 2, or (at your option) any later -;; version. - -;; This file is distributed in the hope that it will be useful, but WITHOUT -;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -;; more details. - -;;; Commentary: - -;; Leverage existing mairix.el to link to particular mail messages, -;; unlike org-mairix.el which uses Gnus or mutt to view the resultant -;; message - -;;; Code: - -(require 'org) -(require 'mairix) -(require 'f) -(require 's) - -(defvar org-mairix-el-store "~/.org-mairix-el-link") - -(org-add-link-type "mairixel" 'org-mairix-el-open) - -(defun org-mairix-el--get-link () - "Return link from `org-mairix-el-store' file." - (substring (s-trim (f-read org-mairix-el-store)) 0 31)) - -(defun org-mairix-el-open (search) - "Function to open a mairix link SEARCH." - (mairix-search (concat "m:" search "=") nil)) - -(defun org-mairix-el-link () - "Return a link with description DESCRIPTION to a message by its ID." - (interactive ) - (when (f-exists? org-mairix-el-store) - (let ((message-id (org-mairix-el--get-link))) - (concat "[[mairixel:" - message-id - "][" - (read-string "E-mail link description: ") - "]]")))) - -(defun org-mairix-el-insert-link () - "Store a link to a message by its ID." - (interactive) - (when (f-exists? org-mairix-el-store) - (let ((message-id (org-mairix-el--get-link))) - (org-insert-link nil (concat "mairixel:" message-id))))) - -(provide 'org-mairix-el) -;;; org-mairix-el ends here diff --git a/.emacs.d/site-lisp/spw-pyblosxom.el b/.emacs.d/site-lisp/spw-pyblosxom.el deleted file mode 100644 index a312231a..00000000 --- a/.emacs.d/site-lisp/spw-pyblosxom.el +++ /dev/null @@ -1,142 +0,0 @@ -;;; spw-pyblosxom --- helper functions for Sean's Org-mode-managed Pyblosxom blog - -;;; Commentary: - -;;; automate repetitive tasks - -;;; Code: - -(require 'magit) -(require 'f) -(require 's) - -(defvar spw-pyblosxom-image-extensions '("png" "jpg" "jpeg") - "Extensions for image files that may be inserted with `spw-pyblosxom-insert-image'.") - -(defun spw-pyblosxom--image-extensions-regexp () - "Put `spw-pyblosxom-image-extensions' into a regexp disjunction." - (let ((regexp "")) - (dolist (elt spw-pyblosxom-image-extensions regexp) - (if (string= regexp "") - (setq regexp elt) - (setq regexp (concat regexp "\\|" elt)))))) - -(defun spw-pyblosxom--get-images (&optional nothumbs) - "Return a list of image files inserted in the buffer with `spw-pyblosxom-insert-image'. -With optional argument NOTHUMBS, exclude thumbnail files." - (let ((images)) - (save-excursion - (goto-char (point-min)) - (while (search-forward-regexp (concat - "\\[http:\\/\\/spw.sdf.org\\/blog\\/\\(.*?\\(" - (spw-pyblosxom--image-extensions-regexp) - "\\)\\)\\]") nil t) - (if (not (and nothumbs (string-match-p (concat "thumb\\.\\(" - (spw-pyblosxom--image-extensions-regexp) - "\\)") - (match-string-no-properties 1)))) - (add-to-list 'images (concat "~/doc/www/blog/" - (match-string-no-properties 1)))))) - images)) - -(defun spw-pyblosxom-publish () - "Set the rdate.py-readable blog publishing timestamp, stage in git and publish." - (interactive) - ;; 1. set the publication date for rdate.py script - (save-excursion - (goto-char (point-min)) - (if (search-forward-regexp "^#\\+HTML: #published [0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} \\(\\?\\?:\\?\\?:\\?\\?\\|[0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\)") - (replace-match (concat "#+HTML: #published " - (format-time-string "%Y-%m-%d %H:%M:00" nil t))) - (message "entry yasnippet broken"))) - (save-buffer) - ;; 2. stage and publish images and post - (let ((to-publish (cons - (buffer-file-name) - (spw-pyblosxom--get-images)))) - - (dolist (elt to-publish) - (org-publish-file elt) - (magit-stage-file (f-relative elt (magit-toplevel))))) - ;; 3. open a magit status buffer - (magit-status (magit-toplevel))) - -(defun spw-pyblosxom-insert-image (file arg) - "Insert image file FILE into one of my blog posts. -With prefix argument ARG, thumbnail it." - (interactive "fimage file: \nP") - ;; 1. copy image file into right directory with sensible filename - (let ((images (spw-pyblosxom--get-images t))) - (let ((images-count (length images))) - (let ((this-image (concat (f-base buffer-file-name) - (number-to-string (+ images-count 1)) - "." - (f-ext file))) - (this-image-thumb (concat (f-base buffer-file-name) - (number-to-string (+ images-count 1)) - "thumb." - (f-ext file)))) - - (copy-file file this-image) - ;; 2. unless arg, create thumbnail - (when (not arg) - (let ((image-size (split-string (shell-command-to-string - (concat - "identify -format \"%w %h\" " - this-image))))) - (let ((image-width (string-to-number (elt image-size 0))) - (image-height (string-to-number (elt image-size 1)))) - (let ((resize-string (if (< image-height image-width) - "500x" "x500"))) - - (call-process-shell-command "convert" nil nil nil - this-image - "-resize" - resize-string - this-image-thumb))))) - ;; 3. insert link into post at point - (insert "[[http://spw.sdf.org/blog" - (replace-regexp-in-string - "/home/swhitton/doc/www/blog" - "" default-directory) - this-image - "]") - (when (not arg) - (insert "[http://spw.sdf.org/blog" - (replace-regexp-in-string - "/home/swhitton/doc/www/blog" - "" default-directory) - this-image-thumb - "]")) - (insert "]"))))) - -(defun spw-pyblosxom-insert-page-link (link) - "Grab HTML <title> of LINK, ask user to edit and then insert Org URI link." - (interactive "sPaste URL: ") - (let ((title (s-trim (shell-command-to-string (concat "httphtmltitle.py " link))))) - (let ((edited-title (read-string "Edit title: " title))) - (insert "[[" link "][" edited-title "]]")))) - -;;;###autoload -(defun spw-pyblosxom-org-mode-hook () - "Perhaps enable spw-pyblosxom-mode when firing up Org-mode." - (if (or load-file-name buffer-file-name) - (if (string-match-p (concat (substitute-in-file-name "$HOME") "/doc/www/blog/") - (file-name-directory (or load-file-name buffer-file-name))) - (spw-pyblosxom-mode)))) - -;;;###autoload -(define-minor-mode spw-pyblosxom-mode - "Helper functions for my Org-mode-managed Pyblosxom blog." - :lighter " spwPb" - :keymap (let ((map (make-sparse-keymap))) - (define-key map (kbd "C-c B B") 'spw-pyblosxom-publish) - (define-key map (kbd "C-c B i") 'spw-pyblosxom-insert-image) - (define-key map (kbd "C-c B l") 'spw-pyblosxom-insert-page-link) - map)) - -;;;###autoload -(add-hook 'org-mode-hook 'spw-pyblosxom-org-mode-hook) - -(provide 'spw-pyblosxom) -;;; spw-pyblosxom.el ends here |