[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 29/39: Moving pabbrev to its own repository.
From: |
Phillip Lord |
Subject: |
[elpa] 29/39: Moving pabbrev to its own repository. |
Date: |
Mon, 20 Oct 2014 08:22:42 +0000 |
phillord pushed a commit to branch externals/pabbrev
in repository elpa.
commit d1c6863855fa7cc25b2ebeeb56835de605e2809d
Author: Phillip Lord <address@hidden>
Date: Tue Sep 16 21:55:38 2014 +0100
Moving pabbrev to its own repository.
---
centering.el | 92 ------------
eval-pulse.el | 274 ----------------------------------
git-update.el | 137 -----------------
greycite.el | 319 ---------------------------------------
leiningen.el | 52 -------
omn-mode.el | 248 -------------------------------
paredit-menu.el | 124 ----------------
paredit-pause.el | 82 ----------
tmmofl-x.el | 75 ----------
tmmofl.el | 435 ------------------------------------------------------
wide-column.el | 367 ---------------------------------------------
11 files changed, 0 insertions(+), 2205 deletions(-)
diff --git a/centering.el b/centering.el
deleted file mode 100644
index 58e53aa..0000000
--- a/centering.el
+++ /dev/null
@@ -1,92 +0,0 @@
-;;; centering.el -- Keep the cursor in the centre at all times.
-
-;; $Revision: 1.14 $
-;; $Date: 2004/12/11 16:48:14 $
-
-;; This file is not part of Emacs
-
-;; Author: Phillip Lord <address@hidden>
-;; Maintainer: Phillip Lord <address@hidden>
-;; Website: http://www.russet.org.uk
-
-;; COPYRIGHT NOTICE
-;;
-;; 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 this program; 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 mode ensures that the cursor is always in the center of the
-;; display. This can be useful at times if, for example, you are
-;; trying to get lots of stuff onto one screen for a screenshot, or to
-;; read without using the keyboard.
-;;
-;; It has one major entry point which is `centering-mode' which turns
-;; on a minor mode.
-;;
-;; It currently works by recentering the display after the line
-;; position has changed. There is a delay before this happens or the
-;; constant redisplaying makes the emacs look horrible. Set
-;; `centering-timer-delay' to change the length of the delay. Setting
-;; it to 0 is permissible.
-
-
-
-;;; Todo
-;;
-;; Well it doesn't work. So fix the centering-recenter function. Also
-;; this should only use a single timer. When switching on, check for
-;; timer, start if not. When switching off check whether there are any
-;; centering buffers left open, if not kill it.
-;;
-;; The current logic is imperfect, because if the a key is
-;; autorepeated, then the system will not update when the up key is
-;; removed. Perhaps I should move back to the old delay system.
-
-
-(define-minor-mode centering-mode
- "Keep the cursor in the center at all times"
- nil
- " Cr"
- nil)
-
-(add-hook 'centering-mode-on-hook
- 'centering-mode-on)
-(add-hook 'centering-mode-off-hook
- 'centering-mode-off)
-
-(defun centering-mode-on()
- (add-hook 'post-command-hook 'centering-post-command-hook nil t))
-
-(defun centering-mode-off()
- (remove-hook 'post-command-hook 'centering-post-command-hook t))
-
-(defun centering-post-command-hook()
- (when centering-timer
- (cancel-timer centering-timer))
- (run-with-timer centering-delay nil
- 'centering-recenter))
-
-(defun centering-recenter()
- (unless (= centering-position
- (line-beginning-position))
- (setq centering-position (line-beginning-position))
- (recenter)))
-
-
-(defvar centering-delay 0.1)
-(defvar centering-timer nil)
-(defvar centering-position 1)
-(make-variable-buffer-local 'centering-position)
\ No newline at end of file
diff --git a/eval-pulse.el b/eval-pulse.el
deleted file mode 100644
index 083c38b..0000000
--- a/eval-pulse.el
+++ /dev/null
@@ -1,274 +0,0 @@
-;;; eval-pulse.el --- Pulse lisp forms as they are evaled
-
-;; This file is not part of Emacs
-
-;; Author: Phillip Lord <address@hidden>
-;; Maintainer: Phillip Lord <address@hidden>
-
-;; COPYRIGHT NOTICE
-;;
-;; 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 this program; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-;;
-;; Makes Emacs "pulse" your lisp forms when you eval them. This gives you a
-;; clear visual indication that you have evaled something and, when evaling
-;; subforms an indication of what you have evaled.
-
-;; To enable this, add
-;;
-;; (require 'eval-pulse)
-;;
-;; to your .emacs, and enable it via a hook in all appropriate buffers.
-
-;; To work this package advices `eval-buffer' and `eval-region', as these
-;; functions are called directly from the menu system. Surely, it can't be a
-;; good idea to change such low-level functions, a core part of the lisp
-;; loading system of Emacs for such a piece of cheap eye-candy?
-
-;;; Status:
-;;
-;; I use it all the time, but then I am easily impressed.
-
-(require 'pulse)
-
-;;; Code:
-(defvar eval-pulse-pulses 0)
-(defvar eval-pulse-form nil)
-
-;; evaling `eval-pulse-depth' causes all sorts of problems, so reset here with
-;; eval-pulse-depth 1
-;;(setq eval-pulse-depth 1)
-(defvar eval-pulse-depth 0)
-(defvar eval-pulse-delay 0.01)
-(defvar eval-pulse-iterations 4)
-
-;; probe to see whether we can pulse the foreground or not. The current
-;; version of pulse sets `pulse-highlight-face' to have a background, while my
-;; hacked version gives this face no characteristics.
-(defvar eval-pulse-can-pulse-foreground
- (not (face-background 'pulse-highlight-face)))
-
-(defface eval-pulse-highlight-start-face
- '((((class color) (background dark))
- (:foreground "#FF0000"))
- (((class color) (background light))
- (:foreground "#FF0000")))
- "Face used at beginning of a highlight."
- :group 'eval-pulse)
-
-;; pulse is hard-coded for background -- bummer
-(defun eval-pulse-momentary-highlight-region
- (start stop)
- "Pulse the region."
- ;; (message "Pulsing: %s:%s:%s:%s" (incf eval-pulse-pulses)
- ;; eval-pulse-form
- ;; eval-pulse-depth
- ;; start stop)
- (let ((pulse-delay eval-pulse-delay)
- (pulse-iterations eval-pulse-iterations))
- ;; only actually pulse when we are at an pulse depth of 1, otherwise we
- ;; get multiple flashes
- (when (and eval-pulse-mode
- (= 1 eval-pulse-depth))
- (pulse-momentary-highlight-region
- start stop
- (if eval-pulse-can-pulse-foreground
- 'eval-pulse-highlight-start-face
- 'pulse-highlight-start-face)))))
-
-(defmacro eval-pulse-one-pulse (form &rest body)
- "Only allow one pulse at a time. The various adviced eval forms
-tend to call each other so this is necessary to avoid flashing screens."
- `(unwind-protect
- (progn (setq eval-pulse-depth
- (+ 1 eval-pulse-depth))
- (setq eval-pulse-form ,form)
- ,@body)
- (setq eval-pulse-depth
- (- eval-pulse-depth 1))))
-
-(defun eval-pulse-last-sexp (position)
- "Pulse the last sexp."
- (eval-pulse-momentary-highlight-region
- (save-excursion
- (goto-char position)
- (backward-sexp)
- (point))
- (save-excursion
- (goto-char position)
- (backward-sexp)
- (forward-sexp)
- (point))))
-
-(defun eval-pulse-defun (position)
- "Pulse the defun at point."
- (eval-pulse-momentary-highlight-region
- (save-excursion
- (goto-char position)
- ;; we move to the end to mimic the behaviour of eval-defun -- we eval
- ;; the defun surrounding point *or* the next one
- (end-of-defun)
- (beginning-of-defun)
- (point))
- (save-excursion
- (goto-char position)
- (end-of-defun)
- (point))))
-
-(defun eval-pulse-region (start stop)
- "Pulse the current region"
- (eval-pulse-momentary-highlight-region
- start stop))
-
-(defun eval-pulse-buffer (buffer)
- "Pulse the current buffer"
- (with-current-buffer
- (or buffer
- (current-buffer))
- (eval-pulse-momentary-highlight-region
- (point-min) (point-max))))
-
-;; advice forms. These do not force loading of the functions that the advice.
-;; which can be adviced afterwards.
-
-;; Elisp
-(defadvice eval-buffer
- (around pulse-eval-buffer activate)
- "Add a pulsing effect to the region evaled."
- (eval-pulse-one-pulse
- 'eval-buffer
- ad-do-it
- (eval-pulse-buffer
- (ad-get-arg 0))))
-
-(defadvice eval-region
- (around pulse-eval-region activate)
- "Add a pulsing effect to the region evaled."
- (eval-pulse-one-pulse
- 'eval-region ad-do-it
- (eval-pulse-region
- (ad-get-arg 0)
- (ad-get-arg 1))))
-
-(defadvice eval-defun
- (around pulse-eval-eval-defun activate)
- "Add a pulsing effect to the region evaled."
- (eval-pulse-one-pulse
- 'eval-defun
- (let ((point (point)))
- ad-do-it
- ;;(message "Evaled defn about to pulse")
- (eval-pulse-defun point))))
-
-(defadvice eval-last-sexp
- (around pulse-eval-last-sexp activate)
- "Add a pulsing effect to the region evaled."
- (eval-pulse-one-pulse
- 'eval-last-sexp
- (let ((point (point)))
- ad-do-it
- (eval-pulse-last-sexp point))))
-
-;; inferior lisp
-(defadvice lisp-eval-defun
- (around pulse-lisp-eval-defun activate)
- "Add a pulsing effect to the region evaled."
- (eval-pulse-one-pulse
- 'lisp-eval-defun
- (let ((point (point)))
- ad-do-it
- (eval-pulse-eval-defun point))))
-
-(defadvice lisp-eval-last-sexp
- (around pulse-lisp-eval-last-sexp activate)
- "Add a pulsing effect to the region evaled."
- (eval-pulse-one-pulse
- 'lisp-eval-last-sexp
- (let ((point (point)))
- ad-do-it
- (eval-pulse-last-sexp point))))
-
-;; clojure
-(defadvice cider-eval-expression-at-point
- (around pulse-cider-eval-expression-at-point activate)
- "Add a pulsing effect to the region evaled."
- (eval-pulse-one-pulse
- 'cider-eval-expression-at-point
- (let ((point (point)))
- ad-do-it
- (eval-pulse-defun point))))
-
-(defadvice cider-eval-ns-form
- (around pulse-cider-eval-ns-form activate)
- "Add a pulsing effect to the region evaled."
- ;; clojure-find-ns is used by cider-eval-ns-form so it will be available
- ;; before this runs
- (eval-pulse-one-pulse
- 'cider-eval-ns-form
- ad-do-it
- (when (clojure-find-ns)
- ;; truely evil use of match data from clojure-find-ns
- (save-excursion
- (eval-pulse-defun (match-beginning 0))))))
-
-(defadvice cider-load-current-buffer
- (around pulse-cider-load-current-buffer activate)
- "Add a pulsing effect to the region evaled."
- (eval-pulse-one-pulse
- 'cider-load-current-buffer
- ad-do-it
- (eval-pulse-buffer (current-buffer))))
-
-(defadvice cider-eval-last-expression
- (around pulse-cider-eval-last-expression activate)
- "Add a pulsing effect to the region evaled."
- (eval-pulse-one-pulse
- 'lisp-eval-last-sexp
- (let ((point (point)))
- ad-do-it
- (eval-pulse-last-sexp point))))
-
-
-;; End Advice
-
-(defvar eval-pulse-disabled nil)
-
-(defun eval-pulse-disable ()
- "Deactivate all advice enabling eval-pulse.
-This is meant for emergency situations."
- (interactive)
- (setq eval-pulse-disabled t)
- (ad-deactivate-regexp "pulse-.*"))
-
-(defun eval-pulse-enable ()
- "Activate all advice enabling eval-pulse.
-This is the default and only needs to be called explicitly after
-`eval-pulse-disable'"
- (interactive)
- (setq eval-pulse-disabled nil)
- (ad-activate-regexp "pulse-.*" t))
-
-(define-minor-mode eval-pulse-mode
- "Pulses lisp expressions when they are evaluated"
- t " ep" nil
- (when
- (and eval-pulse-disabled
- (not eval-pulse-mode))
- (message "Eval pulse mode is enabled, but has been deactivated")))
-
-(provide 'eval-pulse)
-;;; eval-pulse.el ends here
diff --git a/git-update.el b/git-update.el
deleted file mode 100644
index fb8ef51..0000000
--- a/git-update.el
+++ /dev/null
@@ -1,137 +0,0 @@
-;;; git-update.el --- Clone and pull a git repo with Emacs source
-
-;; Version: 1.0
-
-;; This file is not part of Emacs
-
-;; Author: Phillip Lord <address@hidden>
-;; Maintainer: Phillip Lord <address@hidden>
-;; Website: http://www.russet.org.uk
-
-;; COPYRIGHT NOTICE
-;;
-;; 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 this program; 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 ensures that a git repository is cloned, and updates is
-;; regularly. This is useful for using Emacs packages where you want to
-;; stay on the bleeding edge. Think of it as a poor-mans MELPA or el-get.
-;;
-;; It has the advantage over el-get that it's pretty fast -- it's 100 lines
-;; long rather than 1000's. Obviously, it's not as clever either. And it has
-;; the advantage over package.el that it can be used unattended. I use it in
-;; conjunction with `use-package' to maintain many of my external packages; I
-;; maintain a single .emacs files which I synchronize between machines, with
-;; the actual installation taking place automatically, as in this example:
-;;
-;; (use-package clojure-mode
-;; :init (git-update "git://github.com/technomancy/clojure-mode.git"
-;; "~/emacs/packages/development")
-;; :mode ("\\.clj$" . clojure-mode)
-;; :defer t
-;; :config
-;; (add-hook 'clojure-mode-hook 'clojure-test-maybe-enable)
-;;
-;; It has a single entry point `git-update' which takes a repo location and,
-;; optionally a location in which to install. Adding to the load path takes
-;; place automatically.
-
-;;; Code:
-(defvar git-update-install-root (concat user-emacs-directory "git-packages"))
-(defvar git-update-frequency 7)
-(defvar git-update-buffer (get-buffer-create "*git-update*"))
-
-(defun git-update (repo &optional location)
- "Check if the REPO has been cloned into `git-update-install-root'.
-
-If not then run git clone. If not check whether the file
-.git/FETCH_HEAD is older than `git-update-frequency' days old. If
-it is run git pull. Otherwise, do nothing
-Optional argument LOCATION is the directory into which the REPO will be cloned,
-otherwise `git-update-install-root' will be used."
- (let* ((location
- (or location
- (progn
- (when (not (file-exists-p git-update-install-root))
- (make-directory git-update-install-root))
- git-update-install-root)))
- (project-dir
- (concat (or location
- git-update-install-root) "/"
- (git-update-dir-from-git repo))))
- (if (file-exists-p project-dir)
- (git-update-maybe repo project-dir)
- (git-update-clone repo location)
- (git-update-maybe repo project-dir))
- (let ((default-directory project-dir))
- (normal-top-level-add-subdirs-to-load-path))
- (add-to-list 'load-path project-dir)
- project-dir))
-
-(defun git-update-dir-from-git (git-location)
- (first
- (last
- (split-string
- (substring git-location 0 -4) "/" ))))
-
-(defun git-update-clone (repo location)
- (display-buffer git-update-buffer)
- (set-buffer git-update-buffer)
- (goto-char (point-max))
- (message (format "Clone: %s..." repo))
- (insert (format "Clone: %s\n" repo))
- (cd location)
- (call-process "git" nil git-update-buffer t "clone"
- repo)
- (message (format "Clone: %s...done" repo)))
-
-(defun git-update-maybe (repo git-location)
- ;; after a clone, FETCH_HEAD doesn't exist. So, we can't tell when the clone
- ;; happened. So, do a pull anyway.
- (let ((fetch-head (concat git-location "/.git/FETCH_HEAD")))
- (if (not (file-exists-p fetch-head))
- (git-update-do repo git-location)
- (let ((age
- (-
- (time-to-seconds
- (current-time))
- (time-to-seconds
- (nth 5
- (file-attributes
- (concat git-location "/.git/FETCH_HEAD" )))))))
- (if (> age (* git-update-frequency 60 60 24))
- (git-update-do repo git-location)
- (with-current-buffer
- git-update-buffer
- (goto-char (point-max))
- (insert (format "Not updating %s\n" git-location))))))))
-
-(defun git-update-do (repo git-location)
- (display-buffer git-update-buffer)
- (set-buffer git-update-buffer)
- (goto-char (point-max))
- (insert (format "Updating: %s\n\tfrom %s\n"
- git-location repo))
- (goto-char (point-max))
- (cd git-location)
- (call-process "git" nil git-update-buffer t "pull")
- ;; put an extra new line if call-process returns non-zero
- (insert "\n")
- (message "Updating: %s...done" git-location))
-
-(provide 'git-update)
-;;; git-update.el ends here
diff --git a/greycite.el b/greycite.el
deleted file mode 100644
index 588b00f..0000000
--- a/greycite.el
+++ /dev/null
@@ -1,319 +0,0 @@
-;; greycite.el --- integrate referencing with the Greycite service
-
-;; Version: 0.1
-
-;; This file is not part of Emacs
-
-;; Author: Phillip Lord <address@hidden>
-;; Maintainer: Phillip Lord <address@hidden>
-;; Website: http://www.russet.org.uk
-
-;; COPYRIGHT NOTICE
-;;
-;; 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 this program; 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 code in it's early stages. The greycite service aims to make the web
-;; citable by searching and storing basic metadata about articles on the web.
-;; This package helps to integrate Emacs' own referencing capabilities (reftex,
-;; bibtex and the like) with greycite.
-
-;;
-;; There are two main pieces of functionality. First you can use greycite.el
-;; to resolve DOIs or URLs into an equivalent piece of bibtex. This is useful
-;; because it provides the metadata for inserting references, which you can do
-;; using the reftex package which this file modifies to insert citations in
-;; the correct format.
-;;
-;; The main entry points for the bibtex functionality are
-;; `greycite-bibtex-url' which transforms a URL into a bibtex record, or
-;; `greycite-bibtex-update' which updates it. `greycite-bibtex-update' is
-;; currently somewhat destructive of updates that have been made manually, so
-;; you should be careful if this is the case. `greycite-bibtex-doi' and
-;; `greycite-bibtex-doi-update' do similar jobs for DOIs.
-;;
-;; Reftex support is added automatically to adoc-mode. If you prefer to use
-;; some other mode than adoc, `greycite-asciidoc-reftex-support' will turn this
-;; on.
-;;
-
-;;; Code:
-
-;;
-;;
-;; reftex support for asciidoc mode
-;;
-
-(add-hook 'adoc-mode-hook
- 'greycite-asciidoc-reftex-support)
-
-(add-hook 'markdown-mode-hook
- 'greycite-markdown-reftex-support)
-
-
-(defvar greycite-reftex-citation-override nil)
-(defvar greycite-adoc-kblog-cite-format
- '(
- (?\C-m . "kurl:")
- (?4 . "$$[cite]http:")
- (?h . "http:")
- (?j . "http:[]"))
- )
-
-(defvar greycite-markdown-cite-format
- '(
- (?\C-m . "[?](http://)")))
-
-
-(defvar greycite-default-bibliographies
- '("~/documents/bibtex/phil_lord_refs.bib"
- "~/documents/bibtex/phil_lord/phil_lord_all.bib"
- "~/documents/bibtex/urls.bib"
- "~/documents/bibtex/russet.bib"
- "~/documents/bibtex/kblog.bib"
- ))
-
-
-(defun greycite-asciidoc-reftex-support()
- (interactive)
- (greycite-alien-reftex-support greycite-adoc-kblog-cite-format))
-
-(defun greycite-markdown-reftex-support ()
- (interactive)
- (greycite-alien-reftex-support greycite-markdown-cite-format)
- (make-local-variable 'reftex-cite-cleanup-optional-args)
- (setq reftex-cite-cleanup-optional-args nil)
- (add-hook 'greycite-pre-insert-hook
- 'greycite-markdown-pre-hook))
-
-(defun greycite-markdown-pre-hook ()
- (insert "]")
- (save-excursion
- (forward-word -1)
- (insert "[")))
-
-
-(defvar greycite-pre-insert-hook nil)
-
-(defun greycite-alien-reftex-support(cite-format)
- (interactive)
- (reftex-mode 1)
- (make-local-variable 'greycite-reftex-citation-override)
- (setq greycite-reftex-citation-override t)
- (make-local-variable 'reftex-default-bibliography)
- (make-local-variable 'reftex-cite-format)
- (setq reftex-cite-format
- cite-format)
- (setq reftex-default-bibliography greycite-default-bibliographies))
-
-
-(defadvice reftex-format-citation (around greycite-asciidoc-around activate)
- "Alter citation stylue for kcite"
- (if (and greycite-reftex-citation-override
- (not (string= "%2a %y, %T, %B, %j %v:%P, %s %<" format)))
- (progn
- (setq ad-return-value (greycite-reftex-format-citation entry format))
- (run-hooks 'greycite-pre-insert-hook))
- ad-do-it))
-
-;; we can't just use reftex-format-citation -- it has will template with most
-;; keys, but not DOI or URL. So just override it.
-(defun greycite-reftex-format-citation( entry format )
- (cond
- ;; the template strings are duplicated in phil-kblog-cite-format
- ((string= format "kurl:")
- (or
- (greycite-reftex-or-false
- entry "doi" "kurl:dx.doi.org/")
- (greycite-reftex-or-false
- entry "url" "kurl:"
- (lambda(url)
- (substring url 7))
- )))
- ((string= format "$$[cite]http:")
- (concat "$$[cite]" (reftex-get-bib-field "url" entry) "[/cite]$$"))
- ((string= format "http:")
- (reftex-get-bib-field "url" entry))
- ((string= format "http:[]")
- (concat (reftex-get-bib-field "url" entry) "[]"))
- ;; markdown
- ((string= format "[?](http://)")
- (concat "?(" (reftex-get-bib-field "url" entry) ")"))
- (t (error "Format not recognised"))))
-
-
-(defun greycite-reftex-or-false(entry field prefix &optional transform)
- (let ((field-val
- (reftex-get-bib-field field entry)))
- (if (not (string= field-val ""))
- (format " %s%s[]" prefix
- (if transform
- (funcall transform field-val)
- field-val))
- nil)))
-
-(defadvice reftex-format-bib-entry (around greycite-asciidoc-format-bib
activate)
- (setq ad-return-value (greycite-reftex-entry-display entry ad-do-it)))
-
-(defun greycite-reftex-entry-display(entry formatted)
- (let*
- ((url (reftex-get-bib-field "url" entry))
- (doi (reftex-get-bib-field "doi" entry))
- (id
- ;; DOI if we have it, or URL
- (if (not (string= doi ""))
- doi
- url)))
- (put-text-property 0 (length id) 'face reftex-bib-extra-face id)
- ;; chop of last new line
- (concat (substring formatted 0 -1)
- " " id "\n\n")))
-
-
-
-;; bibtex stuff
-(defun greycite-bibtex-from-greycite(url)
- (save-excursion
- (set-buffer
- (url-retrieve-synchronously
- (concat
- "http://greycite.knowledgeblog.org/bib?uri="
- url)))
- (goto-char (point-min))
- (delete-region
- (point-min)
- (search-forward "\n\n"))
- ;; if there isn't a title, then use the URL or nothing appears in reftex.
- (let ((entry
- (bibtex-parse-entry)))
- (when (not
- (assoc "title" entry))
- (search-forward ",")
- (insert "title =")
- (insert (cdr
- (assoc "url" entry)))
- (insert ",")))
- (buffer-string)))
-
-
-(defun greycite-bibtex-url()
- (interactive)
- (let* ((url (thing-at-point 'url))
- (bounds (bounds-of-thing-at-point 'url))
- (bibtex (greycite-bibtex-from-greycite
- url)))
- (delete-region (car bounds) (cdr bounds))
- (insert bibtex)
- (bibtex-clean-entry)
- (bibtex-fill-entry)))
-
-(defun greycite-bibtex-update()
- (interactive)
- (save-restriction
- (bibtex-narrow-to-entry)
- (goto-char (point-min))
- (let* ((entry (bibtex-parse-entry))
- (url
- (substring
- (cdr (assoc "url" entry)) 1 -1))
- (key (cdr (assoc "=key=" entry)))
- (update (greycite-bibtex-from-greycite url)))
- (delete-region (point-min) (point-max))
- (insert update)
- ;; fix the key in case it has changed
- (goto-char (point-min))
- (search-forward "{")
- (zap-to-char 1 ?,)
- (insert (concat key ","))
-
- (bibtex-clean-entry)
- (bibtex-fill-entry))))
-
-
-;; I can't get url-retrieve-synchronously to do content negotiation, so give
-;; up and doi it in PHP instead
-(defun greycite-bibtex-from-doi(doi)
- (save-excursion
- (set-buffer
- (url-retrieve-synchronously
- (concat
- "http://greycite.knowledgeblog.org/resolve/"
- doi)))
- (buffer-string)))
-
-
-(defun greycite-bibtex-doi()
- (interactive)
- ;; thing at point URL is about right, but stuffs "http:" on the beginning.
- ;; hence substring
- (let* ((doi (thing-at-point 'line))
- (bounds (bounds-of-thing-at-point 'line))
- (bibtex (greycite-bibtex-from-doi doi)))
- (delete-region (car bounds)
- (cdr bounds))
- (insert bibtex)
- (bibtex-clean-entry)
- (bibtex-fill-entry)))
-
-;; (nearly) identical to phil-bibtex-update
-(defun greycite-bibtex-doi-update()
- (interactive)
- (save-restriction
- (bibtex-narrow-to-entry)
- (goto-char (point-min))
- (let* ((entry (bibtex-parse-entry))
- (doi
- (substring
- (cdr (assoc "DOI" entry)) 1 -1))
- (key (cdr (assoc "=key=" entry)))
- (update (greycite-bibtex-from-doi doi)))
- (delete-region (point-min) (point-max))
- (insert update)
- ;; fix the key in case it has changed
- (goto-char (point-min))
- (search-forward "{")
- (zap-to-char 1 ?,)
- (insert (concat key ","))
-
- (bibtex-clean-entry)
- (bibtex-fill-entry))))
-
-
-(defun greycite-bibtex-region-from-greycite(start end)
- (interactive "r")
- (save-restriction
- (narrow-to-region start end)
- (goto-char (point-max))
- (while (> (point) (point-min))
- (progn
- (save-excursion
- (greycite-bibtex-url))
- (forward-line -1)
- (sit-for 0.1)))))
-
-(defun greycite-bibtex-buffer-from-greycite()
- (interactive)
- (greycite-bibtex-region-from-greycite
- (point-min) (point-max)))
-
-(defun greycite-buffer ()
- (interactive)
- (while (< -1 (forward-line -1))
- (greycite-bibtex-url)
- (sit-for 2)))
-
-(provide 'greycite)
diff --git a/leiningen.el b/leiningen.el
deleted file mode 100644
index efc0bef..0000000
--- a/leiningen.el
+++ /dev/null
@@ -1,52 +0,0 @@
-;;; leiningen.el --- Run leiningen in a compile buffer with completion
-
-;; This file is not part of Emacs
-
-;; Author: Phillip Lord <address@hidden>
-;; Maintainer: Phillip Lord <address@hidden>
-;; Version: 1.0
-
-;; COPYRIGHT NOTICE
-;;
-;; 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 this program; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;; Commentary:
-;;
-;; Runs leiningen -- a build tool for Clojure -- within a compile buffer.
-;; Useful for testing, gathering dependencies and so on.
-
-;;; Code:
-(defvar leiningen-command "lein")
-
-(defvar leiningen-tasks
- '("clean" "compile" "deploy" "deps" "do" "help" "install"
- "jack-in" "jar" "javac" "marg" "new" "plugin" "pom" "repl"
- "retest" "run" "search" "show-profiles" "swank" "test"
- "trampoline" "uberjar" "upgrade" "version" "with-profile"))
-
-(defun leiningen ()
- (interactive)
- (compile (concat
- leiningen-command " "
- (completing-read "Task: " leiningen-tasks))))
-
-
-(provide 'leiningen)
-
-
-;;; leiningen.el ends here
-
-
diff --git a/omn-mode.el b/omn-mode.el
deleted file mode 100644
index ed2b5a3..0000000
--- a/omn-mode.el
+++ /dev/null
@@ -1,248 +0,0 @@
-;; omn-mode.el --- Support for OWL Manchester Syntax
-
-;; Version: 1.0
-
-;; This file is not part of Emacs
-
-;; Author: Phillip Lord <address@hidden>
-;; Maintainer: Phillip Lord <address@hidden>
-;; Website: http://www.russet.org.uk/blog
-
-;; COPYRIGHT NOTICE
-;;
-;; 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 this program; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-;;
-;; Defines a major mode for editing the Manchester OWL syntax
-;; Basically, this is just a bit of font locking.
-
-
-
-
-(defvar omn-imenu-generic-expression
- '(
- ("Class" "Class: \\([a-zA-Z:_]+\\)" 1)
- ("ObjectProperty" "ObjectProperty: \\([a-zA-Z:_]+\\)" 1)
- ("Individual" "Individual: \\([a-zA-Z:_]+\\)" 1)
- )
-
- "Add support for imenu in omn
-
-See `imenu-generic-expression' for details")
-
-
-;; indentation engine
-(defun omn-indent-line()
- (indent-line-to
- (omn-determine-line-indent)))
-
-(defun omn-determine-line-indent()
- (save-excursion
- (beginning-of-line)
- (save-match-data
- ;; check the first word
-
- (let* ((match (re-search-forward "\\w+" (line-end-position) t))
- (word (if match
- (match-string 0)
- "")))
-
- (cond
- ;; ((not match)
- ;; (progn
- ;; (if (not (forward-line -1))
- ;; (omn-determine-line-indent)
- ;; 0)))
-
- ;; if it is string, ident should be 0.
- ((nth 3 (syntax-ppss (point)))
- 0)
-
- ;; if it is a comment
- ((nth 4 (syntax-ppss (point)))
- ;; if there is a next line, indent the same as that
- (cond
- ((eq 0 (forward-line 1))
- (omn-determine-line-indent))
- ;; if there isn't return the same as the line before
- ((eq 0 (forward-line -1))
- (omn-determine-line-indent))
- ;; who knows?
- (t 0)))
-
- ;; if it is one of Class:, Prefix: or so on, then indent should be 0
- ((member word omn-mode-entity-keywords)
- 0)
- ;; if it is Annotations:, SubClassOf: or so on, then indent should be
4
- ((member word omn-mode-property-keywords)
- 4)
-
- ;; if it is something else, then 8
- (t 8))))))
-
-
-(defvar omn-mode-entity-keywords
- '(
- "Ontology:"
- "Namespace:"
- "Class:"
- "Individual:"
- "ObjectProperty:"
- "Import:"
- "Datatype:"
- "AnnotationProperty:"
- "DisjointClasses:"
- "Prefix:"
- "Alias:"
- "owl:Thing"))
-
-(defvar omn-mode-property-keywords
- '(
- "EquivalentTo:"
- "SubClassOf:"
- "Annotations:"
- "Characteristics:"
- "DisjointUnion:"
- "DisjointWith:"
- "Domain:"
- "Range:"
- "InverseOf:"
- "SubPropertyOf:"
- "Types:"
- "Facts:"
- ))
-
-(add-to-list 'auto-mode-alist
- '("\\.pomn$" . omn-mode))
-
-(add-to-list 'auto-mode-alist
- '("\\.omn$" . omn-mode))
-
-(defvar omn-font-lock-defaults
- `(,
- (concat "\\_<"
- (regexp-opt omn-mode-entity-keywords t)
- "\\_>")
- (,(mapconcat
- (lambda(x) x)
- '("\\<some\\>"
- "\\<only\\>"
- "\\<and\\>"
- "\\<or\\>"
- "\\<exactly\\>"
- "max"
- "min"
- "Transitive"
- "Functional"
- "InverseFunctional"
- )
- "\\|")
- . font-lock-type-face)
- (
- ,(mapconcat
- (lambda(x) x)
- omn-mode-property-keywords
- "\\|")
- . font-lock-builtin-face)
- ("\\w+:\\w+" . font-lock-function-name-face)))
-
-
-(defvar omn-mode-syntax-table
- (let ((st (make-syntax-table)))
- ;; string quotes
- (modify-syntax-entry ?\" "\"" st)
- ;; This is a bit underhand, but we define the < and > characters to be
- ;; "generic-string" delimiters. This results in fontification for URLs
- ;; which is no bad thing. Additionally, it makes the comment character
- ;; work, as "#" is a valid in a URL. The semantics of this isn't quite
- ;; right, because the two characters are not paired. So <url> is
- ;; recognised, but so is <url< or >url>
- (modify-syntax-entry ?\< "|" st)
- (modify-syntax-entry ?\> "|" st)
- ;; define comment characters for syntax
- (modify-syntax-entry ?\# "<" st)
- (modify-syntax-entry ?\n ">" st)
- ;; underscores are valid separators in "words"
- (modify-syntax-entry ?\_ "w" st)
- ;; for name space prefixs
- (modify-syntax-entry ?\: "w" st)
- st))
-
-(defun omn-mode-electric-indent()
- (interactive)
- (self-insert-command 1)
- (omn-mode-indent-here))
-
-(defun omn-mode-indent-here()
- (let ((m (point-marker)))
- (omn-indent-line)
- (goto-char (marker-position m))))
-
-(defun omn-mode-electric-newline()
- (interactive)
- (newline)
- (save-excursion
- (forward-line -1)
- (omn-indent-line)))
-
-(define-derived-mode omn-mode fundamental-mode "Omn"
- "Doc string to add"
-
- ;; font-lock stuff
- (setq font-lock-defaults
- '(omn-font-lock-defaults))
-
- (make-local-variable 'comment-start)
- (make-local-variable 'comment-end)
- (make-local-variable 'comment-start-skip)
- ;; set up commenting
- (setq comment-start "#")
- (setq comment-end "")
- ;; no idea what this is about -- stolen from generic
- (setq comment-start-skip "#+\\s-*")
-
- (set-syntax-table omn-mode-syntax-table)
-
- (setq imenu-generic-expression omn-imenu-generic-expression)
-
- (make-local-variable 'indent-line-function)
- (setq indent-line-function 'omn-indent-line))
-
-
-;; need to bind to return as well
-(mapc
- (lambda(x)
- (define-key omn-mode-map x 'omn-mode-electric-indent))
- `(" " "," ":"))
-
-(define-key omn-mode-map (kbd "RET") 'omn-mode-electric-newline)
-
-
-
-
-(provide 'omn-mode)
-
-;; interaction with a reasoner.....
-;; Define a struct using CL, which defines a command. Then send this to the
command line
-;; program as a single key-value pair line.
-;;
-;; Write a parser for this in Java.
-;; Write a "command" interface, use annotation to mark each of the command
setMethods.
-;;
-;; Have the command interface return results between tags as lisp. We can eval
-;; this, and get the result in that way.
-
diff --git a/paredit-menu.el b/paredit-menu.el
deleted file mode 100644
index ccc5590..0000000
--- a/paredit-menu.el
+++ /dev/null
@@ -1,124 +0,0 @@
-;;; paredit-menu.el --- Adds a menu to paredit.el as memory aid
-
-;; This file is not part of Emacs
-
-;; Author: Phillip Lord <address@hidden>
-;; Maintainer: Phillip Lord <address@hidden>
-;; Keywords: paredit
-;; Version: 1.0
-
-;; COPYRIGHT NOTICE
-;;
-;; 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 this program; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-;;
-;; Paredit mode provides structured editing for Lisp. It achieves this by
-;; ensuring that code is always well-formed while editing. While it is very
-;; helpful, sometimes it leaves the less experienced user (such as the myself)
-;; scratching their head over how to achieve a simple editing task.
-
-;; One solution is to use the cheatsheet
-;; (http://emacswiki.org/emacs/PareditCheatsheet). However, this is outside
-;; Emacs and does not scale well. This file provides a second solution, which
-;; is a menu. While slower than using the equivalent key-presses, it provides
-;; an easy mechanism to look up the relevant commands. Tooltips are also
-;; provided showing the examples of use.
-
-;; Documentation and examples come directly from paredit, so the menu should
-;; automatically stay in sync, regardless of changes to paredit.
-
-;;; Installation:
-;;
-;; Add (require 'paredit-menu) to your .emacs. This will also force loading of
-;; paredit. If you autoload paredit, then
-;;
-;; (eval-after-load "paredit.el"
-;; '(require 'paredit-menu))
-;;
-;; will achieve the same effect.
-
-
-(require 'paredit)
-
-;;; Code:
-
-(defun paredit-menu-build-menu ()
- "Builds the menu from `paredit-commands'."
- (cons "Paredit"
- (paredit-menu-build-menu-1 paredit-commands nil nil)))
-
-(defun paredit-menu-build-menu-1 (commands menu submenu)
- "Really builds the menu.
-
-COMMANDS is the list of commands remaining to add
-MENU is the current menu
-SUBMENU is the current submenu"
- (let ((first (car commands))
- (rest (cdr commands)))
- ;; drop last submenu in place and complete
- (if (not first)
- (append menu (list submenu))
- ;; is a submenu title
- (if (stringp first)
- ;; start a new submenu
- (paredit-menu-build-menu-1
- rest
- ;; appending the last submenu if it exists
- (if submenu
- (append menu (list submenu))
- menu)
- (list first))
- ;; we have a command
- (paredit-menu-build-menu-1
- rest menu
- (append submenu
- (list (vector (paredit-menu-symbol-name
- (symbol-name (nth 1 first)))
- (nth 1 first)
- :help (paredit-menu-help-string first)))))))))
-
-
-(defun paredit-menu-symbol-name (name)
- "Generate display name from symbol name.
-
-No point putting \"paredit\" on the front of everything, so chop
-this off.
-
-NAME is the symbol name."
- (substring name 8))
-
-(defun paredit-menu-help-string (command)
- "Generate help string for command.
-
-COMMAND is the command"
- (let ((string
- (mapconcat
- (lambda (x)
- (format "%s -> \n\t%s" (nth 0 x) (nth 1 x))
- )
- (cddr command) "\n\n")))
- (if (eq "" string)
- "No Example"
- string)))
-
-
-(easy-menu-define menubar-paredit paredit-mode-map "paredit"
- (paredit-menu-build-menu))
-
-(provide 'paredit-menu)
-
-;;; paredit-menu.el ends here
diff --git a/paredit-pause.el b/paredit-pause.el
deleted file mode 100644
index 7e8455e..0000000
--- a/paredit-pause.el
+++ /dev/null
@@ -1,82 +0,0 @@
-;;; paredit-pause.el -- Easily pause and unpause paredit
-
-;; This file is not part of Emacs
-
-;; Author: Phillip Lord <address@hidden>
-;; Maintainer: Phillip Lord <address@hidden>
-;; Keywords: paredit
-;; Version: 1.0
-
-
-;; COPYRIGHT NOTICE
-;;
-;; 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 this program; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-;;
-;; You know how it is. You're wandering happily through your syntax tree, all
-;; your sexps are balanced, your code is looking lovely. Then, suddenly it
-;; happens, you're fixing one of your functions, and bang, you barf one sexp
-;; too many, with C-left. Oh no! So, you C-right before realising that it's
-;; not the opposite. Half your file gets slurped, and probably several other
-;; files that you haven't even opened. You try splitting, wrapping, raising,
-;; it's just gets worse and worse. Randomly symbols get spewed across your
-;; source code, empty forms, and strings everywhere; you look at the hideous
-;; ruin of your work; look at your works, ye mighty, and despair.
-
-;; The solution, is M-x paredit-mode, fix stuff, and then M-x paredit-mode to
-;; get back to where you started. But this takes too long, and is painful,
-;; hence paredit-pause was born.
-
-;; Paredit allows you to toggle paredit-mode on and off with a single
-;; keypress. When paredit-mode is off, it is replaced with paredit-pause-mode,
-;; which you allows you to toggle paredit-mode back on again.
-
-;;; Installation:
-;;
-;; Add (require 'paredit-pause) to your .emacs. Of if you autoload paredit,
-;; then
-;;
-;; (eval-after-load "paredit.el"
-;; '(require 'paredit-menu))
-;;
-;; will achieve the same effect.
-
-(require 'paredit)
-
-;;; Code:
-
-(defun paredit-pause-unpause ()
- "Disable command `paredit-mode' and enable command `paredit-pause-mode'."
- (interactive)
- (paredit-mode 1)
- (paredit-pause-mode 0))
-
-(defun paredit-pause-pause ()
- "Disable mode command `paredit-pause-mode' and enable command
`paredit-mode'."
- (interactive)
- (paredit-mode 0)
- (paredit-pause-mode 1))
-
-(define-key paredit-mode-map "\C-c!" 'paredit-pause-pause)
-
-(define-minor-mode paredit-pause-mode
- "A minor mode which allows easy re-enabling of paredit."
- nil " paredit-pause"
- '(("\C-c!" . paredit-pause-unpause)))
-
-(provide 'paredit-pause)
-;;; paredit-pause.el ends here
diff --git a/tmmofl-x.el b/tmmofl-x.el
deleted file mode 100644
index df80bc5..0000000
--- a/tmmofl-x.el
+++ /dev/null
@@ -1,75 +0,0 @@
-;; tmmofl-x.el - major mode library for tmmofl
-;; $Revision: 1.3 $
-;; $Date: 2000/06/19 22:03:27 $
-
-;; This file is not part of Emacs
-
-;; Author: Phillip Lord<address@hidden>
-;; Maintainer: Phillip Lord
-;; Keywords: minor mode, font lock, toggling, tmmofl,
-
-;; COPYRIGHT NOTICE
-;;
-;; 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 this program; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-
-;;;
-;; Commentary
-;;
-;; All documentation for this file is available in the tmmofl.el file
-
-
-
-(provide 'tmmofl-x)
-
-(defvar tmmofl-jde-mode-actions
- '((font-lock-comment-face
- (lambda()
- (progn
- (abbrev-mode 0)
- (auto-fill-mode 1)))
- (lambda()
- (progn
- (abbrev-mode 1)
- (auto-fill-mode 0))))
-
- (font-lock-string-face
- (lambda()
- (abbrev-mode 0))
- (lambda()
- (abbrev-mode 1)))))
-
-
-(defvar tmmofl-clojure-mode-actions
- '((font-lock-comment-face
- (lambda()
- (progn
- (auto-fill-mode 1)))
- (lambda()
- (progn
- (auto-fill-mode 0))))
-
- (font-lock-string-face
- (lambda()
- (auto-fill-mode 1))
- (lambda()
- (auto-fill-mode 0)))))
-
-
-
-
-
-
diff --git a/tmmofl.el b/tmmofl.el
deleted file mode 100644
index 9140870..0000000
--- a/tmmofl.el
+++ /dev/null
@@ -1,435 +0,0 @@
-;;; tmmofl.el --- Calls functions dependant on font lock highlighting at point
-;; $Revision: 1.9 $
-;; $Date: 2000/06/19 22:05:07 $
-
-;; This file is not part of Emacs
-
-;; Author: Phillip Lord <address@hidden>
-;; Maintainer: Phillip Lord <address@hidden>
-;; Keywords: minor mode, font lock, toggling.
-
-;; COPYRIGHT NOTICE
-;;
-;; 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 this program; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-
-;; Status:
-;;
-;; This seems to work at the moment. It is an extension of the
-;; jde-auto-abbrev.el which I wrote a while back. I wanted to use this
-;; in many other modes as well, so I have written it more
-;; generically. The name by the way stands for "toggle minor mode (based)
-;; on font lock" or "tuh-mof-l". It has recently been re-written
-;; totally. All the macros have gone west, which should make life a
-;; little bit easier. Effectively its entire core has been re-written
-;; and only the peripheral functions really remain the same. It seems
-;; to work for me but it needs more testing...
-;;
-
-;;; Limitations:
-;;
-;; 1) The code looks right, but Im not convinced that the make mode
-;; local hook thing is actually working.
-;; 2) At the moment using tmmofl as a minor mode will conflict with it
-;; being installed as part of the normal function of a mode.
-;; 3) Only works on GnuEmacs at the moment, due to the use of
-;; easy-mmode. It shouldnt take to much effort to remove this requirement
-
-;;; Commentary:
-;;
-;; This code is used to run to functions depending on whether the
-;; current font-lock font is at point. As font-lock is usually
-;; syntactically meaningful this means that you can for instance
-;; toggle minor modes on and off depending on the current syntax.
-;;
-;; To install this software place this file and the tmmofl-x.el file
-;; into your load path and place
-;;
-;; (require 'tmmofl)
-;;
-;; if your .emacs.
-;;
-;; To switch on this minor mode use the command tmmofl-mode. The mode
-;; line will indicate that the mode is switched on. What this actually
-;; does will depend on what the main mode of the current buffer
-;; is. The default behaviour is to switch `auto-fill' mode on when
-;; point is within comments, and off when its in anything else.
-;;
-
-;;; Notes for developers:
-;;~/src/ht/home_website/
-;; There are actually two ways to use this mode, firstly as a minor
-;; mode. Default behaviour is to toggle auto-fill on and off, but you
-;; might want additional behaviour. To do this you define a variable called
-;; `tmmofl-MODENAME-actions' where mode name is the name for mode as
-;; returned by the `major-mode' variable. This variable is as
-;; follows...
-;;
-;;(defvar tmmofl-jde-mode-actions
-;; '(
-;; (font-lock-comment-face
-;; (lambda()
-;; (progn
-;; (abbrev-mode 0)
-;; (auto-fill-mode 1)))
-;; (lambda()
-;; (progn
-;; (abbrev-mode 1)
-;; (auto-fill-mode 0))))
-;;
-;; (font-lock-string-face
-;; (lambda()
-;; (abbrev-mode 0))
-;; (lambda()
-;; (abbrev-mode 1)))))
-;;
-;; This is a list each element of which is a list defining the
-;; font-lock-symbol to be acted on, the on function, and the off
-;; function. If tmmofl can not find this variable the default of...
-;;
-;;(defvar tmmofl-default-actions
-;; '(
-;; (font-lock-comment-face
-;; (lambda()
-;; (auto-fill-mode 1))
-;; (lambda()
-;; (auto-fill-mode 0)))))
-;;
-;; can be used instead, which toggles auto fill on and off when on of
-;; off comments. There are some sample action variables defined in
-;; tmmofl-x.el which you may load if you wish.
-;;
-;; The second way to use this mode is outside of the tmmofl minor
-;; mode. For instance say you wanted emacs to display the fully
-;; referenced name of a class every time you moved point on top of a
-;; Type declaration in Java code. If you had a function called
-;; `java-show-full-class-name' (which I dont before you ask) you might
-;; want to use tmmofl to call this function. To do this you would use
-;; the `tmmofl-install-for-mode' function like so...
-;;
-;;(tmmofl-install-for-mode
-;; java-mode-hook
-;; font-lock-type-face
-;; (lambda()
-;; (java-show-full-class-name))
-;; (lambda()
-;; ()))
-;;
-;; where the first argument is the install hook. This would work
-;; without showing the tmmofl mode information in the mode line. I am
-;; fairly sure that this should work independantely of `tmmofl-mode'.
-
-;; The software was designed, written and tested on win 95, using
-;; NTEmacs. It has since been rewritten on a Gnu/Linux system. Please
-;; let me know if it works elsewhere. The current version should be
-;; available at http://www.bioinf.man.ac.uk/~lord
-;;
-
-;;; Acknowledgements:
-;;
-;; This code has grown up over about a year. It originally started off
-;; as jde-auto-abbrev. I would like to thank Joakim Verona
-;; (address@hidden) who sent me the code which did part of what
-;; tmmofl does (toggled abbrev mode!). He used `defadvice' on
-;; `put-text-property'. I got the idea for using `post-command-hook'
-;; from Gerd Neugebauer's multi-mode.el.
-;; Finally Stefan Monnier who gave me lots of good advice about both
-;; the overall structure of the file, and some specific problems I
-;; had. Thanks a lot. Much appreciated.
-
-;; TODO
-;;
-;; More stuff in tmmofl-x.el, but at the moment its working quite
-;; nicely.
-;;
-
-;;; History:
-;;
-;; $Log: tmmofl.el,v $
-;; Revision 1.9 2000/06/19 22:05:07 phil
-;; Total rewrite
-;;
-;; Revision 1.8 2000/04/11 19:15:16 phil
-;; Updated documentation
-;;
-;; Revision 1.7 2000/01/25 14:24:18 lord
-;; Now requires easy-mmode, which it needs.
-;; Documentation changes
-;;
-;; Revision 1.6 1999-12-21 17:09:03+00 phillip2
-;; Applied Eric Ludlam's checkdoc to buffer
-;;
-;;
-
-;;; Code:
-(eval-when-compile (require 'cl))
-(require 'cl)
-(require 'font-lock)
-(require 'easy-mmode)
-
-(defvar tmmofl-default-actions
- '((font-lock-comment-face
- (lambda()
- (auto-fill-mode 1))
- (lambda()
- (auto-fill-mode 0))))
- "Standard actions when mode specific actions are not provided.")
-
-
-(defvar tmmofl-actions nil
- "An list which stores the functions to be run for a given face.
-Each element of the list is off form (face on-function off-function)")
-
-(make-variable-buffer-local 'tmmofl-actions)
-
-(defvar tmmofl-font-lock-symbols-cache nil
- "Internal cache so we know where we were.")
-
-(make-variable-buffer-local 'tmmofl-font-lock-symbols-cache)
-
-(defun tmmofl-post-command-hook-function()
- "Run on the post command hook"
- (interactive)
- (condition-case err
- (let ((faces-at-point (get-text-property (point) 'face)))
- ;;run the on and off functions
- (tmmofl-run-off-functions faces-at-point)
- (tmmofl-run-on-functions faces-at-point)
- ;;and remember these for next time
- (setq tmmofl-font-lock-symbols-cache faces-at-point))
- (error
- ;;if there is a problem in the called functions show the error message
- ;;and then bomb out. If we dont do this emacs will empty
post-command-hook for
- ;;us silently which makes things difficult to debug, and may also
- ;;other packages which use post-command-hook.
- (progn (message "Error caught by tmmofl: %s" (error-message-string err))
- (remove-hook 'post-command-hook
'tmmofl-post-command-hook-function)))))
-
-(defun tmmofl-run-on-functions-for-face ( current-face )
- "Run the on functions defined for CURRENT-FACE."
- (interactive)
- (dolist (face-and-action tmmofl-actions)
- (if (eq (car face-and-action) current-face)
- (funcall (nth 1 face-and-action)))))
-
-(defun tmmofl-run-on-functions (faces-at-point)
- "Run the on functions.
-Those faces in FACES-AT-POINT that are not also in
-`tmmofl-font-lock-symbols-cache' have just been moved onto,
-so we should run the on-functions"
- (tmmofl-iterate-and-run-functions 'tmmofl-run-on-functions-for-face
- faces-at-point
- tmmofl-font-lock-symbols-cache))
-
-(defun tmmofl-run-off-functions-for-face( face )
- "Runs the off functions for this face"
- (interactive)
- (dolist (face-and-action tmmofl-actions)
- (if (eq (car face-and-action) face)
- (funcall (nth 2 face-and-action)))))
-
-
-(defun tmmofl-run-off-functions( faces-at-point )
- "Runs the off functions.
-Those faces in `tmmofl-font-lock-symbols-cache' that are not also in
`faces-at-point'
-have just been moved off, so we should run the off-functions"
- (tmmofl-iterate-and-run-functions 'tmmofl-run-off-functions-for-face
- tmmofl-font-lock-symbols-cache
- faces-at-point))
-
-(defun tmmofl-iterate-and-run-functions( function-to-call faces-to-interate
faces-cache )
- "Calls functions depending on changes in faces.
-If a face is in `faces-to-iterate' but not in `faces-cache', then call
-`function-to-call' with that face as an argument"
- (let ((remaining-faces faces-to-interate))
- ;;iterate through all of faces in the cache
- (while remaining-faces
- (let ((current-face
- (if (listp remaining-faces)
- (car remaining-faces)
- remaining-faces)))
- ;;is the current face also at point.If not run the off-function
- ;;if its theres a nil cache do it
- (if (not faces-cache)
- (funcall function-to-call current-face)
- ;;else if its a list and it DOES not contain it
- (if (and (listp faces-cache)
- (not (memq current-face faces-cache)))
- (funcall function-to-call current-face)
- ;;else if it is not equal. There must be a better way of doing this
- (if (not (eq current-face faces-cache))
- (funcall function-to-call current-face))))
- (setq remaining-faces (cdr-safe remaining-faces))))))
-
-(defun tmmofl-ensure-buffer-tmmofl-ready()
- "Ensure that the `tmmofl-post-command-hook-function' is on the
-post-command-hook and that this hook is local"
- (add-hook 'post-command-hook 'tmmofl-post-command-hook-function nil t))
-
-(defun tmmofl-possibly-remove-tmmofl-readiness()
- "Remove the `tmmofl-post-command-hook-function' from the
-post-command-hook, if `tmmofl-actions' is empty. "
- ;;if both of these two are empty
- (if (not tmmofl-actions)
- ;;then we can make this non-local. Cant really make it no longer
- ;;local as we dont know that something else hasnt already make
- ;;it so
- (remove-hook 'post-command-hook
- 'tmmofl-post-command-hook-function t)))
-
-(defun tmmofl-install-in-buffer
- ( face on-function off-function )
- "Install the functions to be run for a given face.
-On moving onto a part of the buffer fontified by FACE run
-ON-FUNCTION. When moving of this run OFF-FUNCTION."
- ;;make sure all the hooks are in the right place
- (tmmofl-ensure-buffer-tmmofl-ready)
- ;;now add to the on-actions. We should really check here that we have not
already got
- ;;an identical component on the list but at the moment I can be bothered
- (push (list face on-function off-function) tmmofl-actions))
-
-(defun tmmofl-deinstall-from-buffer
- ( face on-function off-function )
- "Deinstall the following functions from tmmofl.
-This works by removing them from `tmmofl-actions'. Should also remove
-`tmmofl-post-command-hook-function' from `post-command-hook' if
-appropriate.
-Argument FACE the face affected.
-Argument ON-FUNCTION the function to run when moving on.
-Argument OFF-FUNCTION the function to run on moving off."
- ;;on actions first
- (setq tmmofl-actions
- (delete
- (list face on-function off-function)
- tmmofl-actions))
- ;;and if there is nothing left remove the hooks
- (tmmofl-possibly-remove-tmmofl-readiness))
-
-(defun tmmofl-blitz-from-buffer()
- "Remove all tmmofl-actions from current buffer, under all circumstances.
-This is an emergency function to be used in case of tmmofl related disasters.
It
-may leave tmmofl-minor-mode in an inconsistant state"
- (interactive)
- ;;kill the hook
- (remove-hook 'post-command-hook
- 'tmmofl-post-command-hook-function
- t)
- ;;kill the action variables
- (setq tmmofl-actions nil))
-
-(defun tmmofl-blitz-from-buffer-for-symbol (symbol)
- "Remove all the `tmmofl-actions' from the current buffer for `SYMBOL'.
-This is an emergency function to be used in case of tmmofl related disasters.
-It removes all actions for a given font-lock-symbol regardless of the function.
-Like `tmmofl-blitz-from-buffer' it may leave tmmofl-minor-mode in a
-inconsistant state."
- (interactive "MSymbol to untmmofl: ")
- (setq tmmofl-actions
- (remove* (intern symbol) tmmofl-actions :key 'car)))
-
-(defun tmmofl-install-for-mode (install-hook face on-function off-function)
- "Install tmmofl on any buffer running the hook INSTALL-HOOK.
-Functions added in this way operate independantly of tmmofl-minor-mode
-Argument FACE the face affected.
-Argument ON-FUNCTION function to run moving onto FACE.
-Argument OFF-FUNCTION function to run moving off FACE."
- (interactive)
- (add-hook install-hook
- (lambda()
- "This function was auto-coded by `tmmofl-install-for-mode'"
- (tmmofl-install-in-buffer
- face
- on-function
- off-function))))
-
-(defun tmmofl-install-action(command)
- "Install tmmofl `action' in the current buffer.
-The action should consist of a font-lock-symbol, and function to run on moving
-onto this face, and another to run on moving off this symbol. Actually it does
-need to be a font-lock-face, but if it isnt the functions will never be
called."
- (let ((face (nth 0 command))
- (on-function (nth 1 command))
- (off-function (nth 2 command)))
- (tmmofl-install-in-buffer face
- on-function
- off-function)))
-
-(defun tmmofl-deinstall-action(command)
- "Deinstall `action' in the current buffer.
-See `tmmofl-install-action' which is the complementary function."
- (let ((face (nth 0 command))
- (on-function (nth 1 command))
- (off-function (nth 2 command)))
- (tmmofl-deinstall-from-buffer face
- on-function
- off-function)))
-
-(defun tmmofl-install-mode-actions()
- "Add all of the actions defined as appropriate for this mode"
- (let ((list (tmmofl-get-actions-for-mode)))
- (while list
- (let ((cur (car list)))
- (progn
- (tmmofl-install-action cur)
- (setq list (cdr list)))))))
-
-(defun tmmofl-deinstall-mode-actions()
- "Remove all of the actions defined as appropriate for this mode"
- (interactive)
- (let ((list (tmmofl-get-actions-for-mode)))
- (while list
- (let ((cur (car list)))
- (progn
- (tmmofl-deinstall-action cur)
- (setq list (cdr list)))))))
-
-(defun tmmofl-get-actions-for-mode()
- "Get the actions defined as appropriate for this mode"
- (let((mode-variable (intern (concat "tmmofl-" (symbol-name major-mode)
"-actions"))))
- (if (boundp mode-variable)
- (eval mode-variable)
- tmmofl-default-actions)))
-
-;;we also want to define a minor mode which allows others to define
-;;tmmofl additions to their own major odes.
-(easy-mmode-define-minor-mode tmmofl-mode
-"Toggle tmmofl minor mode.
-With no arguments, this command toggles the mode.
-Non-null prefix argument turns on the mode.
-Null prefix argument turns off the mode.
-
-When tmmofl mode is enabled various other minor
-modes are turned on or off, depending on the fontification
-scheme at point. This is useful for instance for turning on
- whilst in comments, and turning it off whilst
-in code.
-
-tmmofl minor mode provides a default minor mode toggle
-(which is auto-filling as described above). This may be altered in a
-mode specific way by defining function foo-tmmofl-install for
-foo-mode."
-;;the initial value
-nil
-;;the mode line indicator
-" Tmmofl" nil)
-
-(add-hook 'tmmofl-mode-on-hook 'tmmofl-install-mode-actions)
-(add-hook 'tmmofl-mode-off-hook 'tmmofl-deinstall-mode-actions)
-
-(provide 'tmmofl)
-
-;;; tmmofl.el ends here
-
diff --git a/wide-column.el b/wide-column.el
deleted file mode 100644
index e75c2e0..0000000
--- a/wide-column.el
+++ /dev/null
@@ -1,367 +0,0 @@
-;;; wide-column.el --- Calls functions dependant on column position.
-;; $Revision: 1.4 $
-;; $Date: 2002/04/05 09:28:09 $
-
-;; This file is not part of Emacs
-
-;; Copyright (c) 2002 Phillip Lord
-
-;; Author: Phillip Lord <address@hidden>
-;; Maintainer: Phillip Lord <address@hidden>
-;; Keywords: minor mode, cursor colour, column width
-
-;; COPYRIGHT NOTICE
-;;
-;; 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 Foundationl; 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 this program; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-;;; Status:
-;;
-;; This has been released for quite a while now, and works well for
-;; me. There are few issues with it, which are mentioned in issues.
-;; It's pretty much ready, but I haven't put custom support in yet
-;; which would be nice.
-
-
-;;; Commentary:
-;;
-;; This package is designed to run functions depending on the column
-;; that the cursor is in. My initial idea with it, is just to have it
-;; change the cursor colour, lightening it as you go over the fill
-;; column length.
-;;
-;; The point of this is that monitor sizes have in recent years got
-;; plain silly, and its now relatively easy to buy one the size of a
-;; small wardrobe. Combined with the other wise wonderful
-;; `dabbrev-expand' which makes it feasible to use very explantory,
-;; and very long variable, and function names, source code has a habit
-;; of becoming stupidly wide. Now of course this wouldn't matter very
-;; much, if we all had wide screens. However in recent years, flat
-;; screen monitors have become widely prevelant, and these generally
-;; have lower resolutions, and smaller screen sizes, unless you are
-;; very rich. This raises the nasty possibility of a split therefore
-;; in behaviour between those using LCD, and CRT based monitors.
-;; Coming, as I do, from the left of the political spectrum, naturally
-;; I find such divisiveness worrying. This, therefore, is my
-;; contribution to preventing it.
-;;
-;; This package functions as a normal minor mode, so
-;; `wide-column-mode' toggles it on and off. There is also a global
-;; minor mode which you can access with `global-wide-column-mode'
-;; (Emacs 21 only). There is a problem with the getting the default
-;; cursor colour; this happens when wide-column is loaded, and I can't
-;; get around it without a hook in `set-cursor-color'. Set the
-;; variable `wide-column-default-cursor-colour' which will solve this
-;; problem.
-;;
-
-;;; Similar Packages:
-;;
-;; Sandip Chitale (address@hidden) highlight-beyond-fill
-
-;;; Installation
-;;
-;; Place this file in your Emacs load path. Put (require 'wide-column)
-;; into your .emacs or equivalent file. This operates as a normal
-;; minor mode, so `wide-column-mode' will toggle it on and off.
-;;
-;; The code was developed on Gnu Emacs 21. Emacs 20 support has now
-;; been removed because it required code duplication horribleness.
-;;
-;; It may work on XEmacs, but I don't have one around to try. You will
-;; certainly need the fsf compatibility packages if you do.
-
-;;; Issues;
-;;
-;; 1) I'm not sure about the error handling. I think things are
-;; working quite well. However if the affector function crashes out,
-;; it will appear to the user that wide-column mode is on, but
-;; actually, it will be disabled. I can solve this easily, by
-;; switching the mode off on errors, but easy-mmode produces
-;; mini-buffer messages, which hide my own attempts to provide error
-;; reporting. I think this way is better. If a crash happens the
-;; system will be inconsistent, but the alternative will be to have
-;; the minor-mode switch itself off.
-;;
-;; 2) The colour list is poor. I would like to improve things here,
-;; but I am not sure how. See the comments near the definition of
-;; `wide-column-colour-list'
-;;
-;; 3) Custom support would be good, and no doubt will be added at some
-;; time.
-;;
-;; 4) It's not going to work if people use lots of different default
-;; cursor colours. Seems like a daft thing to do to me! Something to
-;; work on anyway. Maybe I could solve this by advicing
-;; `set-cursor-colour', but this would fail if someone uses
-;; `modify-frame-parameters' directly, and I really don't want to
-;; advice this function anyway.
-
-(require 'easy-mmode)
-
-;;; Code:
-
-;; Basic variables. Defcustom these later.
-(defvar wide-column-start-width nil
- "The column beyond which the `wide-column-affector-function' is called.
-If this variable is set to nil then the value of `fill-column' is
-used instead.")
-
-(make-variable-buffer-local 'wide-column-start-width)
-
-(defvar wide-column-affector-function 'wide-column-warning-colour
- "This defines the main affector function.
-This function is called when the cursor is at a position greater than
-`wide-column-start-width'. If this affector function fails for some
-reason then errors are reported to the mini-buffer. The system will
-try to do its best to return things to normal, but obviously this is a
-programming error somewhere, so there are no guarentees.
-
-The affector function must have the following properties:-
-
-It should take a single parameter.
-
-If this parameter is positive then it is the amount that the cursor
-position is in excess of the maximum. The function will be called
-after every command while the cursor is beyond the maximum allowable
-value, so don't make it too heavy weight, or it will make editing
-slow.
-
-If the parameter is negative, or zero then its still the amount that
-the cursor is in excess of the maximum (i.e. the cursor is lower than
-or equal to the maximum). The function will be called with these
-values however only when moving from over the maximum to below it
-once, as an optimisation.
-
-If the parameter is the symbol `on', then it mean that the function is
-being called for the first time in this buffer, and it should do what
-ever is necessary.
-
-If the parameter is the symbol `off', then it means that the mode is
-being switched off, in the current buffer.
-
-If the parameter is the symbol `reset' then it means that the cursor
-has moved out of the old buffer and into a new one, and a reset should
-happen. Its important to realise here that when this reset happens
-the `current-buffer' may or may not be using the option
-`wide-column-mode'. The function only needs to do something
-therefore, if it affects a global property, like for instance the
-cursor colour. If it affects a buffer local property, then IT WILL BE
-IN THE WRONG BUFFER
-
-And finally it shouldn't do anything daft, like leaving the current
-buffer changed, probably it shouldn't move point. Deleting all of the
-text in excess of the wide column would be amusing, but still perhaps
-not a good idea.")
-
-(make-variable-buffer-local 'wide-column-affector-function)
-
-;;; This section provides the basic functionality of the mode.
-(defvar wide-column-last-command-over-width-p nil
- "The last command executed beyond the maximum width.")
-(make-variable-buffer-local 'wide-column-last-command-over-width-p)
-
-(defvar wide-column-buffer-affector-last-called-in nil
- "The last buffer an affector was called in.
-This is the last buffer that any `wide-column-affector-function' was
-called in. This information is recorded so that things can be reset,
-when the buffer is moved out of.")
-
-(defvar wide-column-affector-function-last-called nil
- "This is the last affector function that was called.")
-
-(defun wide-column-post-command-hook-function()
- "This calls the function specified by `wide-column-affector-function'
-when the cursor is beyond the column `wide-column-start-width' if it
-is set, or `fill-column' if it is not. See the documentation of
-`wide-column-affector-function' for full details."
- (interactive)
- (condition-case err
- (progn
- (let ((buffer (current-buffer)))
- (if (not (eq wide-column-buffer-affector-last-called-in buffer))
- ;; we have moved out of the a wide column buffer,
- ;; therefore we need to reset the affector from the last
- ;; buffer
- (if wide-column-affector-function-last-called
- (funcall wide-column-affector-function-last-called 'reset))))
- ;; now only actually do anything if wide-column-mode is on
- (if wide-column-mode
- (let ((column-position (current-column))
- (start-width
- (or wide-column-start-width
- fill-column)))
- (if (> column-position start-width)
- (progn
- (wide-column-call-affector)
- (setq wide-column-last-command-over-width-p t))
- (if wide-column-last-command-over-width-p
- (progn (wide-column-call-affector)
- (setq wide-column-last-command-over-width-p
nil)))))))
- (error
- ;; this catches errors in this function, or in the affector
- ;; function. If I don't do this then emacs just empties
- ;; post-command-hook, which makes things a pain in the ass to
- ;; debug, and will affect other packages using this hook
- (progn
- ;; Switch the mode off. This will leave the system in an
- ;; inconsistent state, as the minor mode will still appear to
- ;; be on. I am not sure what to do with this. I've tried just
- ;; switching the mode off, but the informative message from
- ;; easy-mmode covers up the error report.
- (wide-column-mode-emergency-off)
- (backtrace)
- (message "Error from `wide-column-affector-function' caught: %s"
- (error-message-string err))))))
-
-(defun wide-column-call-affector ()
- "Call the affector with the column position."
- ;; sing hey diddle dey, for dynamic scoping
- (funcall wide-column-affector-function (- column-position start-width))
- ;; record this stuff so that we can reset correctly.
- (setq wide-column-affector-function-last-called
wide-column-affector-function)
- (setq wide-column-buffer-affector-last-called-in (current-buffer)))
-
-(define-minor-mode wide-column-mode
- "Toggle wide-column mode.
-With no argument, this command toggles this mode.
-Non-null prefix arguments turns on the mode,
-Null prefix argument turns it off.
-
-When wide-column mode is enabled, the function defined in
-`wide-column-affector-function' is called, when your cursor has gone
-beyond `wide-column-start-width' if it's set, or `fill-column' it
-its not.
-
-By default the practical upshot of this is that cursor colour changes,
-when your lines get too long."
- :group 'wide-column
- :lighter " Wc"
- (if wide-column-mode
- (progn
- ;; add hook if we need to.
- (wide-column-mode-reset)
- (funcall wide-column-affector-function 'on))
- (funcall wide-column-affector-function 'off)))
-
-
-;; define global-minor-mode
-(define-global-minor-mode global-wide-column-mode
- wide-column-mode wide-column-turn-on)
-
-;; (add-hook
-;; 'global-wide-column-mode-hook
-;; 'global-wide-column-hook)))
-
-;; (defun global-wide-column-hook()
-;; "Help to switch off global mode"
-;; (interactive)
-;; (if (not global-wide-column-mode)
-;; (funcall wide-column-affector-function 'off)))
-
-(defun wide-column-turn-on()
- (wide-column-mode 1))
-
-(defun wide-column-mode-emergency-off()
- "Get out of `wide-column-mode'. Calling this function disabled this mode
-totally, and irrespective of whether its actually switched on or
-not. It's an emergency function, in case of crashes, and should not
-normally be called. `wide-column-mode-reset' turns it back on again. "
- (interactive)
- ;; switch mode off
- (remove-hook 'post-command-hook
- 'wide-column-post-command-hook-function))
-
-;; I can't find any leaving or entering buffer hooks. So I have to use
-;; a global post-command hook. I don't really like this, but what can
-;; you do?
-
-(defun wide-column-mode-reset()
- "This function resets` wide-column mode' if its been switched off due to
errors"
- (interactive)
- (add-hook 'post-command-hook
- 'wide-column-post-command-hook-function))
-
-
-;; This is the bit which provides the colour switching code, which is
-;; the default behaviour of this package.
-
-
-;; with faces you can set colours depending on whether the background
-;; is dark or light. I don't know how to do this with colour
-;; names. Also the colour list that I am using here is fine for me,
-;; but its based on my usual cursor colour. What I would really like
-;; to do is lighten the colour each time I move further from the
-;; fill-column. So it would be nice to be able to get from one colour
-;; to the next automatically, without just specifying a list.
-(defvar wide-column-colour-list
- '("orange" "yellow" "white"))
-
-(setq wide-column-warning-colour-quotient 5)
-
-(defvar wide-column-default-cursor-colour
- (frame-parameter (selected-frame) 'cursor-color)
- "Place to store the default cursor colour.")
-
-(defun wide-column-warning-colour (current-excess-column)
- "Set the cursor colour depending on the column position"
- ;; first we need to test for a flag condition, mostly to
- ;; reset or store the current cursor colour.
- (cond
- ((or (eq 'reset current-excess-column)
- (eq 'off current-excess-column))
- (set-cursor-color wide-column-default-cursor-colour))
- ;; switched on the first time.
- ((eq 'on current-excess-column)
- nil)
- ;;(setq wide-column-default-cursor-colour
- ;; (frame-parameter (selected-frame) 'cursor-color)))
- ;; now we need to actually do the cursor colour change. Change it
- ;; back to default.
- ((>= 0 current-excess-column)
- (set-cursor-color wide-column-default-cursor-colour))
- ;; change it toggles something else.
- (t
- (let* ((max-colour-index
- (- (length wide-column-colour-list) 1))
- (suggested-colour-number
- (/ current-excess-column wide-column-warning-colour-quotient))
- (actual-colour-number
- (if (> suggested-colour-number max-colour-index)
- max-colour-index
- suggested-colour-number)))
- (set-cursor-color (nth actual-colour-number
wide-column-colour-list))))))
-
-;; Some test code
-(defun wide-column-warning-colour-test()
- (interactive)
- (wide-column-warning-colour
- (- (current-column) 20)))
-
-(defun wide-column-shout-about-affector()
- (interactive)
- (setq wide-column-affector-function
- (lambda(current-excess-column)
- (message "Wide Column Affector called with column %s"
current-excess-column))))
-
-(defun wide-column-restore-default-affector()
- (interactive)
- (setq wide-column-affector-function
- 'wide-column-warning-colour))
- ;(default-value wide-column-affector-function)))
-
-(provide 'wide-column)
-
-;;; wide-column.el ends here
- [elpa] 33/39: README.md update for version 4.0, (continued)
- [elpa] 33/39: README.md update for version 4.0, Phillip Lord, 2014/10/20
- [elpa] 01/39: Initial checkin to Mercurial, Phillip Lord, 2014/10/20
- [elpa] 39/39: Set version to 0 for ELPA., Phillip Lord, 2014/10/20
- [elpa] 35/39: Prepare for next iteration., Phillip Lord, 2014/10/20
- [elpa] 38/39: Updated copyright date., Phillip Lord, 2014/10/20
- [elpa] 37/39: Use with-current-buffer, Phillip Lord, 2014/10/20
- [elpa] 28/39: Whitespace cleanup!, Phillip Lord, 2014/10/20
- [elpa] 36/39: set-overlays appeared twice., Phillip Lord, 2014/10/20
- [elpa] 31/39: Checkdoc completed., Phillip Lord, 2014/10/20
- [elpa] 30/39: COPYING added., Phillip Lord, 2014/10/20
- [elpa] 29/39: Moving pabbrev to its own repository.,
Phillip Lord <=