Browse Source

Big change: Emacs and packages come from nixpkgs

  * Use `nix build` to build everything (and install my config)

  * Perfect for use with Home Manager!
master
Peter J. Jones 1 year ago
parent
commit
a2e289fd38
Signed by: Peter Jones <pjones@devalot.com> GPG Key ID: 9DAFAA8D01941E49
54 changed files with 161 additions and 3988 deletions
  1. 1
    0
      .gitignore
  2. 0
    13
      GNUmakefile
  3. 1
    1
      LICENSE
  4. 17
    24
      README.md
  5. 0
    16
      bin/GNUmakefile
  6. 0
    4
      bin/eterm
  7. 109
    0
      default.nix
  8. 7
    1
      dot.emacs.el
  9. 0
    59
      emacs.mk
  10. 0
    6
      lisp/GNUmakefile
  11. 0
    21
      lisp/autoload.el
  12. 0
    18
      lisp/gnus-init.el
  13. 1
    1
      lisp/keys.el
  14. 18
    20
      lisp/loadpath.el
  15. 0
    1
      lisp/modes.el
  16. 0
    1
      lisp/options.el
  17. 0
    77
      lisp/packages.el
  18. 6
    14
      lisp/projector.el
  19. 0
    1
      lisp/suspend.el
  20. 0
    2
      modes/GNUmakefile
  21. 0
    17
      modes/bbdb-conf.el
  22. 0
    1
      modes/bm-conf.el
  23. 0
    2
      modes/circe-conf.el
  24. 1
    5
      modes/company-conf.el
  25. 0
    1
      modes/company-ghc-conf.el
  26. 0
    1
      modes/conf-mode-conf.el
  27. 0
    1
      modes/css-mode-conf.el
  28. 0
    1
      modes/deft-conf.el
  29. 0
    18
      modes/eshell-conf.el
  30. 0
    1
      modes/flycheck-conf.el
  31. 0
    2
      modes/haskell-mode-conf.el
  32. 0
    4
      modes/highline-conf.el
  33. 0
    1
      modes/js-conf.el
  34. 0
    1
      modes/markdown-mode-conf.el
  35. 0
    1
      modes/message-conf.el
  36. 0
    1
      modes/oauth2-conf.el
  37. 0
    20
      modes/oddmuse-conf.el
  38. 0
    1
      modes/plstore-conf.el
  39. 0
    1
      modes/rcirc-conf.el
  40. 0
    1
      modes/sgml-mode-conf.el
  41. 0
    1
      modes/simple-conf.el
  42. 0
    1
      modes/speedbar-conf.el
  43. 0
    2
      modes/yaml-mode-conf.el
  44. 0
    7
      modes/yasnippet-conf.el
  45. 0
    11
      scripts/check-emacs-output.sh
  46. 0
    16
      snippets/GNUmakefile
  47. 0
    7
      snippets/js-mode/function
  48. 0
    3
      third-party/GNUmakefile
  49. 0
    559
      third-party/boxquote.el
  50. 0
    317
      third-party/goto-chg.el
  51. 0
    919
      third-party/graphviz-dot-mode.el
  52. 0
    1109
      third-party/highline.el
  53. 0
    551
      third-party/oddmuse.el
  54. 0
    124
      third-party/rcirc-color.el

+ 1
- 0
.gitignore View File

@@ -1 +1,2 @@
1 1
 *.elc
2
+/result

+ 0
- 13
GNUmakefile View File

@@ -1,13 +0,0 @@
1
-DIRS = third-party lisp modes snippets themes bin
2
-DOTFILE = $(HOME)/.emacs
3
-MAKE_ARGS = --no-print-directory
4
-
5
-.PHONEY: all
6
-
7
-all: $(DOTFILE)
8
-
9
-all uninstall:
10
-	@ for d in $(DIRS); do $(MAKE) $(MAKE_ARGS) -C $$d $@ || exit 1; done
11
-
12
-$(DOTFILE): dot.emacs.el
13
-	cp $< $@

+ 1
- 1
LICENSE View File

@@ -1,4 +1,4 @@
1
-Copyright (c) 2008-2014 Peter Jones <pjones@devalot.com>
1
+Copyright (c) 2008-2018 Peter Jones <pjones@devalot.com>
2 2
 
3 3
 All rights reserved.
4 4
 

+ 17
- 24
README.md View File

@@ -1,31 +1,18 @@
1 1
 # Emacs Configuration
2 2
 
3
-This repository contains my [Emacs] [] configuration.  I thought I'd
3
+This repository contains my [Emacs][] configuration.  I thought I'd
4 4
 share it with the rest of the world because I'm doing a few
5 5
 interesting things:
6 6
 
7 7
   * As you can see, configuration is split among several files instead
8 8
     of having one giant configuration file.  More on this below.
9 9
 
10
-  * All files are compiled into byte code and installed in
11
-    `~/.emacs.d` automatically using [GNU Make] [].
12
-
13
-  * I'm slowly switching to the modern Emacs package system.  Some of
14
-    the libraries I rely on are not yet available as packages so for
15
-    those I have scripts and Makefiles for downloading and installing
16
-    them.
17
-
18
-  * Libraries that I use that are available as packages are
19
-    automatically installed by Make.
10
+  * All files are compiled into byte code for faster loading
20 11
 
21 12
 ## Configuration Organization
22 13
 
23 14
   * `bin`: Custom tools I use with Emacs.
24 15
 
25
-  * `download`: Libraries that are not yet available as packages (or I
26
-    haven't updated this directory yet) but are available as tarballs
27
-    or source code repositories.  Automatically installed by Make.
28
-
29 16
   * `lisp`: Basic configuration files organized by function.
30 17
 
31 18
   * `modes`: One configuration file for each mode that I have
@@ -33,17 +20,23 @@ interesting things:
33 20
     needed.  See `lisp/modes.el` for more information.  This makes a
34 21
     big difference for Emacs start-up time.
35 22
 
36
-  * `scripts`: Scripts I use for compiling the configuration, etc.
37
-
38 23
   * `themes`: Custom color themes.
39 24
 
40
-  * `third-party`: Libraries acquired via the [Emacs Wiki] [] that may
41
-    now be available as packages, but I haven't needed to update this
42
-    repo yet.  I only plan on removing files from here as things break
43
-    after Emacs upgrades or I need a new feature.
44
-
45 25
   * The `dot.emacs.el` file bootstraps all of this.
46 26
 
27
+## Installation
28
+
29
+What to try this configuration out without having to change your
30
+existing configuartion in any way?
31
+
32
+  1. Install the [Nix Package Manager](https://nixos.org/nix/)
33
+
34
+  2. Run the following command:
35
+
36
+         nix build
37
+
38
+  3. Start Emacs:
39
+
40
+         ./result/bin/emacs -q --load ./result/dot.emacs.el -f pjones:configure-new-frame
41
+
47 42
 [emacs]: http://www.gnu.org/software/emacs/
48
-[gnu make]: http://www.gnu.org/software/make/
49
-[emacs wiki]: http://www.emacswiki.org/emacs/

+ 0
- 16
bin/GNUmakefile View File

@@ -1,16 +0,0 @@
1
-FILES = $(shell ls | grep -v Makefile)
2
-
3
-.PHONEY: all
4
-
5
-all: $(HOME)/bin $(foreach f,$(FILES),$(HOME)/bin/$(f))
6
-	@:
7
-
8
-$(HOME)/bin:
9
-	mkdir -p $@
10
-
11
-define COPY_template
12
-$(HOME)/bin/$(1): $(1)
13
-	install -m 0770 $(1) $(HOME)/bin/$(1)
14
-endef
15
-
16
-$(foreach f,$(FILES),$(eval $(call COPY_template,$(f))))

+ 0
- 4
bin/eterm View File

@@ -1,4 +0,0 @@
1
-#!/bin/sh -eu
2
-
3
-# Open an Emacs terminal.
4
-e -ne '(pjones:terminal "'`pwd`'")'

+ 109
- 0
default.nix View File

@@ -0,0 +1,109 @@
1
+{ pkgs ? (import <nixpkgs> {}).pkgs }:
2
+
3
+let
4
+  emacs = pkgs.emacs.override {
5
+    withX    = true;
6
+    withGTK2 = false;
7
+    withGTK3 = false;
8
+  };
9
+
10
+  emacsWithPackages = (pkgs.emacsPackagesNgGen emacs).emacsWithPackages;
11
+
12
+  pjones = pkgs.stdenv.mkDerivation rec {
13
+    name = "emacsrc";
14
+    src = ./.;
15
+
16
+    phases = [ "installPhase" ];
17
+    buildInputs = [ emacs'
18
+                    pkgs.gitAndTools.gitFull # needed to compile magit config
19
+                  ];
20
+
21
+    installPhase = ''
22
+      mkdir -p "$out/bin" "$out/emacs.d"
23
+
24
+      export loadpathel="$out/emacs.d/lisp/loadpath.el"
25
+      substituteAll ${src}/dot.emacs.el "$out/dot.emacs.el"
26
+
27
+      cp -r ${src}/lisp ${src}/modes "$out/emacs.d/"
28
+      cp -r ${src}/bin/* "$out/bin/"
29
+      chmod u+w "$out"/emacs.d/*
30
+      chmod 0555 "$out"/bin/*
31
+
32
+      for f in ${emacs'}/bin/*; do
33
+        ln -nfs "$f" "$out/bin/"
34
+      done
35
+
36
+      for f in $(find "$out/emacs.d" -type f -name "*.el"); do
37
+        emacs -Q --quick --batch -f package-initialize \
38
+          --load "$loadpathel" -f batch-byte-compile "$f"
39
+      done
40
+    '';
41
+  };
42
+
43
+  emacs' =
44
+    emacsWithPackages (epkgs: (with epkgs.melpaPackages; [
45
+      beginend
46
+      bm
47
+      circe
48
+      circe-notifications
49
+      color-theme-sanityinc-tomorrow
50
+      company
51
+      company-ghc
52
+      company-quickhelp
53
+      company-statistics
54
+      dante
55
+      deft
56
+
57
+      # FIXME:
58
+      # dictionary broken :(
59
+
60
+      dired-filter
61
+      dired-narrow
62
+      dired-sidebar
63
+      dired-subtree
64
+      flx
65
+      flx-ido
66
+      flycheck
67
+      git-annex
68
+      god-mode
69
+      google-contacts
70
+      goto-chg
71
+      graphviz-dot-mode
72
+      indium
73
+      haskell-mode
74
+      highlight-indent-guides
75
+      htmlize
76
+      http
77
+      hydra
78
+      ido-completing-read-plus
79
+      idomenu
80
+      inf-ruby
81
+      js2-mode
82
+      magit
83
+      magit-annex
84
+      markdown-mode
85
+      nix-mode
86
+      noccur
87
+      no-littering
88
+      org-tree-slide
89
+      passmm
90
+      projectile
91
+      ruby-end
92
+      scad-mode
93
+      smex
94
+      smtpmail-multi
95
+      switch-window
96
+      yaml-mode
97
+
98
+    ]) ++ (with epkgs.elpaPackages; [
99
+      rainbow-mode
100
+
101
+    ]) ++ (with epkgs.orgPackages; [
102
+      org
103
+
104
+    ]) ++ (with epkgs; [
105
+      pdf-tools
106
+
107
+    ]));
108
+
109
+in pjones

+ 7
- 1
dot.emacs.el View File

@@ -1,3 +1,9 @@
1
+;; Important load settings:
2
+(setq user-emacs-directory (expand-file-name "~/.cache/emacs"))
3
+
4
+;; Prepare package management
5
+(package-initialize)
6
+
1 7
 ;; Load other configuration files
2
-(load (concat user-emacs-directory "pjones/lisp/loadpath"))
8
+(load "@loadpathel@")
3 9
 (pjones:load-configuration-files)

+ 0
- 59
emacs.mk View File

@@ -1,59 +0,0 @@
1
-##############################################################################
2
-SRC	 ?= $(wildcard *.el)
3
-COMPILED  = $(patsubst %.el,$(DEST)/%.elc,$(SRC))
4
-PMADE_LOAD_PATH ?= $(CURDIR)/../lisp/loadpath.el
5
-IGNORE_EMACS_WARNINGS ?= YES
6
-
7
-##############################################################################
8
-EMACS = emacs
9
-EMACS_FLAGS = -Q --quick --batch
10
-EMACS_FLAGS += --eval "(add-to-list 'load-path \".\")"
11
-EMACS_FLAGS += --eval "(setq max-lisp-eval-depth 1200)"
12
-EMACS_FLAGS += -l $(PMADE_LOAD_PATH)
13
-EMACS_FLAGS += -f package-initialize
14
-EMACS_FLAGS += -f batch-byte-compile
15
-
16
-##############################################################################
17
-CHECK_EMACS_OUTPUT ?= $(dir $(PMADE_LOAD_PATH))/../scripts/check-emacs-output.sh
18
-EMACS_OUTPUT_FILE = emacs.out
19
-
20
-##############################################################################
21
-.PHONEY: all
22
-
23
-##############################################################################
24
-all: $(DEST) $(COMPILED) $(addprefix $(DEST)/,$(TO_REMOVE))
25
-	@:
26
-
27
-##############################################################################
28
-uninstall:
29
-	rm -f $(COMPILED)
30
-
31
-##############################################################################
32
-.SUFFIXES: .el .elc
33
-
34
-##############################################################################
35
-$(DEST)/%.elc: %.el
36
-	@ echo emacs compile $<
37
-	@ mkdir -p $(HOME)/.emacs.d/share/emacs/site-lisp
38
-	@ $(EMACS) $(EMACS_FLAGS) $< > $(EMACS_OUTPUT_FILE) 2>&1; exit
39
-ifeq ($(IGNORE_EMACS_WARNINGS),)
40
-	@ if [ `$(CHECK_EMACS_OUTPUT) < $(EMACS_OUTPUT_FILE)` -ne 0 ]; then \
41
-	    cat $(EMACS_OUTPUT_FILE); exit 1; \
42
-	  fi
43
-else
44
-	@ cat $(EMACS_OUTPUT_FILE)
45
-endif
46
-	@ rm $(EMACS_OUTPUT_FILE)
47
-	@ mv $(<:.el=.elc) $@
48
-	@ if [ "$(EMACS_INSTALL_PACKAGES)" = "$<" ]; then \
49
-	    echo emacs packages install; \
50
-	    $(EMACS) -Q --batch -l $(PMADE_LOAD_PATH) -l $< -f "pjones:install-packages"; \
51
-	  fi
52
-
53
-##############################################################################
54
-$(DEST):
55
-	mkdir -p $@
56
-
57
-##############################################################################
58
-$(addprefix $(DEST)/,$(TO_REMOVE))::
59
-	@ rm -f $@

+ 0
- 6
lisp/GNUmakefile View File

@@ -1,6 +0,0 @@
1
-DEST = ~/.emacs.d/pjones/lisp
2
-EMACS_INSTALL_PACKAGES = packages.el
3
-
4
-${DEST}/themes.elc: ${DEST}/packages.elc
5
-
6
-include ../emacs.mk

+ 0
- 21
lisp/autoload.el View File

@@ -1,21 +0,0 @@
1
-;;; autoload.el -- Automatically load some libraries when their
2
-;;; functions are called.  Mostly for stuff in my third-party
3
-;;; directory.
4
-
5
-;; Go-to Last Change
6
-(autoload 'goto-last-change "goto-chg" nil t)
7
-(autoload 'goto-last-change-reverse "goto-chg" nil t)
8
-
9
-;; Markdown mode
10
-(autoload 'markdown-mode "markdown-mode" nil t)
11
-
12
-;; Visual Bookmarks
13
-(autoload 'bm-toggle   "bm" "Toggle bookmark in current buffer." t)
14
-(autoload 'bm-next     "bm" "Goto bookmark."                     t)
15
-(autoload 'bm-previous "bm" "Goto previous bookmark."            t)
16
-
17
-;; Highline (http://emacswiki.org/emacs/HighlineMode)
18
-(autoload 'highline-mode "highline" "Highline Mode" t)
19
-
20
-;; RHTML (.html.erb for Rails)
21
-(autoload 'rhtml-mode "rhtml-mode" "RHTML" t)

+ 0
- 18
lisp/gnus-init.el View File

@@ -1,18 +0,0 @@
1
-;;; gnus.el -- Settings that need to configured before Gnus can run.
2
-(eval-when-compile
3
-  (require 'gnus)
4
-  (require 'gnus-start)
5
-  (require 'gnus-agent)
6
-  (require 'nnfolder)
7
-  (require 'nndraft))
8
-
9
-;; Bring in an external Gnus, but first we need to set some location
10
-;; variables otherwise Gnus will load and create the wrong
11
-;; directories.
12
-(setq mail-default-directory (expand-file-name "~/.gnus.d/")
13
-      gnus-startup-file (concat mail-default-directory "newsrc")
14
-      gnus-directory (concat mail-default-directory "news")
15
-      gnus-agent-directory (concat mail-default-directory "agent")
16
-      message-directory (concat mail-default-directory "mail")
17
-      nnfolder-directory (concat mail-default-directory "mail")
18
-      nndraft-directory (concat mail-default-directory "mail"))

+ 1
- 1
lisp/keys.el View File

@@ -64,7 +64,7 @@
64 64
 (define-key pjones:z-map (kbd "e")   'hydra-launch/body)
65 65
 (define-key pjones:z-map (kbd "f")   'pjones:kill-file-name)
66 66
 (define-key pjones:z-map (kbd "g")   'rgrep)
67
-(define-key pjones:z-map (kbd "H")   'highline-mode)
67
+(define-key pjones:z-map (kbd "h")   'hl-line-mode)
68 68
 (define-key pjones:z-map (kbd "i")   'idomenu)
69 69
 (define-key pjones:z-map (kbd "I")   'pjones:uuid)
70 70
 (define-key pjones:z-map (kbd "J")   'pjones:journal)

+ 18
- 20
lisp/loadpath.el View File

@@ -1,32 +1,30 @@
1
-;;; loadpath.el -- Correctly set my load-path variable. <
1
+;;; loadpath.el -- Correctly set my load-path variable.
2 2
 
3 3
 ;; Some basic variables used by my other configuration files.
4
-(defvar pjones:lisp-dir (concat user-emacs-directory "pjones/lisp/")
4
+(defvar pjones:lisp-dir
5
+  (file-name-directory load-file-name)
5 6
   "The directory where I store my general Emacs configuration files.")
6 7
 
7
-(defvar pjones:modes-dir (concat user-emacs-directory "pjones/modes/")
8
+(defvar pjones:modes-dir
9
+  (concat (file-name-directory (directory-file-name pjones:lisp-dir)) "modes")
8 10
   "The directory where I keep mode-specific configuration files.")
9 11
 
10
-(defvar pjones:site-lisp (concat user-emacs-directory "share/emacs/site-lisp")
11
-  "The directory where I install extra software packages like org-mode.")
12
-
13 12
 (defvar pjones:lisp-files
14
-  '("packages" "themes" "code" "modes" "options" "autoload" "automode"
15
-    "functions" "interactive" "completion" "keys" "gnus-init"
16
-    "projector" "projects" "suspend")
13
+  '( "themes"
14
+     "code"
15
+     "modes"
16
+     "options"
17
+     "automode"
18
+     "functions"
19
+     "interactive"
20
+     "completion"
21
+     "keys"
22
+     "projector"
23
+     "projects"
24
+     "suspend"
25
+    )
17 26
   "A list of my config files to load in the correct order.")
18 27
 
19
-;; Add my "site-lisp" directory to load-path.
20
-(add-to-list 'load-path pjones:site-lisp)
21
-
22
-;; Add all directories in "site-lisp" to the load-path.
23
-(dolist (d (directory-files pjones:site-lisp t))
24
-  (cond
25
-   ((file-directory-p (concat d "/lisp"))
26
-    (add-to-list 'load-path (concat d "/lisp")))
27
-   ((file-directory-p d)
28
-    (add-to-list 'load-path d))))
29
-
30 28
 (defun pjones:load-configuration-files ()
31 29
   "Load all of my lisp configuration files."
32 30
   (dolist (file pjones:lisp-files)

+ 0
- 1
lisp/modes.el View File

@@ -1,5 +1,4 @@
1 1
 ;;; modes.el -- Load files from ~/.emacs.d/pjones/modes on demand.
2
-(eval-when-compile (load "loadpath.el"))
3 2
 
4 3
 ;; Global minor modes
5 4
 (winner-mode)

+ 0
- 1
lisp/options.el View File

@@ -2,7 +2,6 @@
2 2
 ;;; Commentary:
3 3
 ;;; Code:
4 4
 (eval-when-compile
5
-  (load "./packages")
6 5
   (require 'server))
7 6
 
8 7
 ;; Personal information

+ 0
- 77
lisp/packages.el View File

@@ -1,77 +0,0 @@
1
-;;; packages.el -- Emacs package management
2
-(require 'package)
3
-
4
-(defvar pjones:package-archives
5
-  '(("melpa" . "http://melpa.org/packages/")
6
-    ("org"   . "http://orgmode.org/elpa/"))
7
-  "List of package archives to use with Emacs.")
8
-
9
-(defvar pjones:packages
10
-  '( beginend
11
-     bm
12
-     circe
13
-     circe-notifications
14
-     color-theme-sanityinc-tomorrow
15
-     company
16
-     company-flx
17
-     company-ghc
18
-     company-quickhelp
19
-     company-statistics
20
-     dante
21
-     deft
22
-     dictionary
23
-     dired-filter
24
-     dired-narrow
25
-     dired-sidebar
26
-     dired-subtree
27
-     flx
28
-     flx-ido
29
-     flycheck
30
-     gist
31
-     git-annex
32
-     god-mode
33
-     google-contacts
34
-     graphviz-dot-mode
35
-     indium
36
-     haskell-mode
37
-     highlight-indent-guides
38
-     htmlize
39
-     http
40
-     hydra
41
-     ido-completing-read+
42
-     idomenu
43
-     inf-ruby
44
-     js2-mode
45
-     magit
46
-     magit-annex
47
-     markdown-mode
48
-     nix-mode
49
-     nlinum
50
-     noccur
51
-     no-littering
52
-     org
53
-     org-tree-slide
54
-     passmm
55
-     projectile
56
-     rainbow-mode
57
-     ruby-end
58
-     scad-mode
59
-     smex
60
-     smtpmail-multi
61
-     switch-window
62
-     yaml-mode
63
-   )
64
-  "A list of packages to ensure are installed at launch.")
65
-
66
-;; Prepare package management
67
-(package-initialize)
68
-
69
-(dolist (archive pjones:package-archives)
70
-  (add-to-list 'package-archives archive))
71
-
72
-;; Make sure all the packages are installed
73
-(defun pjones:install-packages ()
74
-  (package-refresh-contents)
75
-  (dolist (p pjones:packages)
76
-    (when (not (package-installed-p p))
77
-      (package-install p t))))

+ 6
- 14
lisp/projector.el View File

@@ -4,9 +4,6 @@
4 4
 ;;
5 5
 ;;
6 6
 ;;; Code:
7
-(eval-when-compile
8
-  (require 'highline))
9
-
10 7
 (defvar pjones:projector-font-big
11 8
   "Dejavu Sans Mono-18"
12 9
   "A large font to use for projectors.")
@@ -24,34 +21,29 @@
24 21
   (set-frame-font (or font pjones:projector-font-big)))
25 22
 
26 23
 (defun pjones:projector-highline ()
27
-  "Toggle highline mode from outside Emacs."
24
+  "Toggle hl-line-mode mode from outside Emacs."
28 25
   (with-current-buffer (window-buffer (selected-window))
29
-    (call-interactively 'highline-mode)))
26
+    (call-interactively 'hi-line-mode)))
30 27
 
31 28
 (defun pjones:projector-next-line ()
32 29
   "Move to the next line from outside Emacs."
33 30
   (with-current-buffer (window-buffer (selected-window))
34
-    (call-interactively 'next-line)
35
-    (if highline-mode (highline-highlight-current-line))))
31
+    (call-interactively 'next-line)))
36 32
 
37 33
 (defun pjones:projector-prev-line ()
38 34
   "Move to the previous line from outside Emacs."
39 35
   (with-current-buffer (window-buffer (selected-window))
40
-    (call-interactively 'previous-line)
41
-    (if highline-mode (highline-highlight-current-line))))
36
+    (call-interactively 'previous-line)))
42 37
 
43 38
 (defun pjones:projector-recenter ()
44 39
   "Places the current line at the top of the window from outside
45 40
 Emacs."
46 41
   (with-current-buffer (window-buffer (selected-window))
47
-    (recenter 0)
48
-    (if highline-mode (highline-highlight-current-line))))
42
+    (recenter 0)))
49 43
 
50 44
 (defun pjones:projector-other-window ()
51 45
   "Move to the other window from outside Emacs."
52
-  (select-window (next-window nil 0 'visible))
53
-  (if highline-mode (highline-highlight-current-line)))
54
-
46
+  (select-window (next-window nil 0 'visible)))
55 47
 
56 48
 (define-minor-mode projector-mode
57 49
   "Global minor mode that makes things look nice on a projector."

+ 0
- 1
lisp/suspend.el View File

@@ -1,6 +1,5 @@
1 1
 ;;; suspend.el --- Secure Emacs on a system suspend, sleep, lock, etc.
2 2
 (eval-when-compile
3
-  (load "./packages.el")
4 3
   (require 'circe))
5 4
 
6 5
 ;; Require libraries at run time.

+ 0
- 2
modes/GNUmakefile View File

@@ -1,2 +0,0 @@
1
-DEST = ~/.emacs.d/pjones/modes
2
-include ../emacs.mk

+ 0
- 17
modes/bbdb-conf.el View File

@@ -1,17 +0,0 @@
1
-;;; bbdb-conf.el -- Big Brother Database config.
2
-(eval-when-compile
3
-  (load "../lisp/packages.el")
4
-  (require 'bbdb))
5
-
6
-(setq
7
- ; Cycling while completing email addresses:
8
- bbdb-complete-mail-allow-cycling t
9
-
10
- ; Currently a remote server is the master:
11
- bbdb-read-only t
12
- bbdb-auto-revert t
13
-
14
- ; No popup-buffers:
15
- bbdb-pop-up-window-size 0
16
- bbdb-pop-up-layout 'one-line
17
- bbdb-mua-pop-up nil)

+ 0
- 1
modes/bm-conf.el View File

@@ -1,6 +1,5 @@
1 1
 ;;; bm-conf.el -- Visual bookmarks configuration.
2 2
 (eval-when-compile
3
-  (load "../lisp/packages.el")
4 3
   (require 'bm))
5 4
 
6 5
 (setq bm-highlight-style 'bm-highlight-only-fringe

+ 0
- 2
modes/circe-conf.el View File

@@ -1,7 +1,5 @@
1 1
 ;;; circe-conf.el -- Settings for circe.el
2 2
 (eval-when-compile
3
-  (load "../lisp/packages.el")
4
-  (load "../lisp/functions.el")
5 3
   (require 'circe))
6 4
 
7 5
 (require 'circe-notifications)

+ 1
- 5
modes/company-conf.el View File

@@ -1,10 +1,8 @@
1 1
 ;;; company-conf.el --- company-mode configuration.
2 2
 (eval-when-compile
3
-  (load "../lisp/packages.el")
4 3
   (require 'company)
5 4
   (require 'company-quickhelp)
6
-  (require 'company-statistics)
7
-  (require 'company-flx))
5
+  (require 'company-statistics))
8 6
 
9 7
 ;; Settings for company-mode:
10 8
 (custom-set-variables
@@ -39,8 +37,6 @@
39 37
     (define-key map (kbd "M-h")   #'company-quickhelp-manual-begin)
40 38
     (define-key map (kbd "<tab>") #'company-complete-common-or-cycle))
41 39
 
42
-  ;; Enable fuzzy (flx) matching in company-mode.
43
-  (company-flx-mode +1)
44 40
   (company-quickhelp-mode +1)
45 41
   (company-statistics-mode))
46 42
 

+ 0
- 1
modes/company-ghc-conf.el View File

@@ -1,6 +1,5 @@
1 1
 ;;; company-ghc-conf.el --- company-mode ghc-mod backend.
2 2
 (eval-when-compile
3
-  (load "../lisp/packages.el")
4 3
   (require 'company-ghc))
5 4
 
6 5
 (setq company-ghc-show-info t

+ 0
- 1
modes/conf-mode-conf.el View File

@@ -1,6 +1,5 @@
1 1
 ;;; conf-mode-conf.el -- Settings for conf-mode.
2 2
 (eval-when-compile
3
-  (load "../lisp/code.el")
4 3
   (require 'conf-mode))
5 4
 
6 5
 (declare-function pjones:add-programming-hook "code.el")

+ 0
- 1
modes/css-mode-conf.el View File

@@ -1,6 +1,5 @@
1 1
 ;;; css-mode-conf.el -- Settings for css-mode.
2 2
 (eval-when-compile
3
-  (load "../lisp/code.el")
4 3
   (require 'css-mode)
5 4
   (require 'company))
6 5
 

+ 0
- 1
modes/deft-conf.el View File

@@ -2,7 +2,6 @@
2 2
 (eval-when-compile
3 3
   (require 'deft))
4 4
 
5
-
6 5
 (custom-set-variables
7 6
   `(deft-directory ,(expand-file-name "~/notes/"))
8 7
   '(deft-recursive t)

+ 0
- 18
modes/eshell-conf.el View File

@@ -2,7 +2,6 @@
2 2
 (eval-when-compile
3 3
   (require 'eshell))
4 4
 
5
-(require 'powerline)
6 5
 (require 'esh-mode)
7 6
 
8 7
 (custom-set-variables
@@ -11,26 +10,9 @@
11 10
  '(eshell-where-to-jump (quote after))
12 11
  '(eshell-smart-space-goes-to-end t))
13 12
 
14
-(defun pjones:eshell-prompt-function ()
15
-  (let* ((separator-left (intern (format "powerline-%s-%s"
16
-                                         (powerline-current-separator)
17
-                                         (car powerline-default-separator-dir))))
18
-         (face0 'powerline-active0)
19
-         (face1 'powerline-active1)
20
-         (face2 'powerline-active2)
21
-         (dir (abbreviate-file-name (eshell/pwd)))
22
-         (host (concat (user-login-name) "@" system-name))
23
-         (bar (list (powerline-raw host face0 'l)
24
-                    (funcall separator-left face0 face1)
25
-                    (powerline-raw dir  face1 'l)
26
-                    (funcall separator-left face1 'default))))
27
-    (concat (powerline-render bar)
28
-            "\n❯ ")))
29
-
30 13
 (defun pjones:eshell-mode-hook ()
31 14
   "Customize Eshell."
32 15
   (require 'em-smart)
33
-  (setq eshell-prompt-function 'pjones:eshell-prompt-function)
34 16
   (eshell-smart-initialize))
35 17
 
36 18
 (defvar eshell-mode-hook "Why isn't this defined?" nil)

+ 0
- 1
modes/flycheck-conf.el View File

@@ -1,6 +1,5 @@
1 1
 ;;; flycheck-conf.el -- Configuration for flycheck.
2 2
 (eval-when-compile
3
-  (load "../lisp/packages.el")
4 3
   (require 'flycheck))
5 4
 
6 5
 (custom-set-variables

+ 0
- 2
modes/haskell-mode-conf.el View File

@@ -1,7 +1,5 @@
1 1
 ;;; haskell-mode-conf.el -- Settings for Haskell mode.
2 2
 (eval-when-compile
3
-  (load "../lisp/code.el")
4
-  (load "../lisp/functions.el")
5 3
   (require 'cl)
6 4
   (require 'haskell-mode))
7 5
 

+ 0
- 4
modes/highline-conf.el View File

@@ -1,4 +0,0 @@
1
-;;; highline-conf.el -- Settings for highline-mode.
2
-(eval-when-compile (require 'highline))
3
-(setq highline-priority 10
4
-      highline-face 'highlight)

+ 0
- 1
modes/js-conf.el View File

@@ -2,7 +2,6 @@
2 2
 ;;; Commentary:
3 3
 ;;; Code:
4 4
 (eval-when-compile
5
-  (load "../lisp/packages.el")
6 5
   (require 'js))
7 6
 
8 7
 ;; JavaScript mode settings

+ 0
- 1
modes/markdown-mode-conf.el View File

@@ -1,6 +1,5 @@
1 1
 ;;; markdown-conf.el -- Settings for markdown-mode.
2 2
 (eval-when-compile
3
-  (load "../lisp/code.el")
4 3
   (require 'markdown-mode)
5 4
   (require 'whitespace)
6 5
   (require 'company))

+ 0
- 1
modes/message-conf.el View File

@@ -2,7 +2,6 @@
2 2
 ;;; Commentary:
3 3
 ;;; Code:
4 4
 (eval-when-compile
5
-  (load "../lisp/packages.el")
6 5
   (require 'company)
7 6
   (require 'message))
8 7
 

+ 0
- 1
modes/oauth2-conf.el View File

@@ -1,6 +1,5 @@
1 1
 ;;; oauth2-conf.el -- OAuth Configuration.
2 2
 (eval-when-compile
3
-  (load "../lisp/packages.el")
4 3
   (require 'oauth2))
5 4
 
6 5
 (custom-set-variables

+ 0
- 20
modes/oddmuse-conf.el View File

@@ -1,20 +0,0 @@
1
-;;; oddmuse-conf.el -- Settings for Oddmuse (EmacsWiki).
2
-(eval-when-compile (require 'oddmuse))
3
-
4
-(declare-function oddmuse-mode-initialize "oddmuse.el")
5
-
6
-(defun pmade-oddmuse-hook ()
7
-  "Hook is run after oddmuse is started"
8
-  (unless (string-match "question" oddmuse-post)
9
-    (setq oddmuse-post (concat "uihnscuskc=1;" oddmuse-post))))
10
-
11
-(setq oddmuse-username "PeterJones")
12
-(setq oddmuse-directory "~/.oddmuse")
13
-
14
-(defun pmade-oddmuse-edit ()
15
-  "Load oddmuse and run oddmuse-edit."
16
-  (interactive)
17
-  (require 'oddmuse)
18
-  (add-hook 'oddmuse-mode-hook 'pmade-oddmuse-hook)
19
-  (oddmuse-mode-initialize)
20
-  (call-interactively 'oddmuse-edit))

+ 0
- 1
modes/plstore-conf.el View File

@@ -1,6 +1,5 @@
1 1
 ;;; plstore-conf.el -- Settings for plstore.el.
2 2
 (eval-when-compile
3
-  (load "../lisp/packages.el")
4 3
   (require 'plstore))
5 4
 
6 5
 (custom-set-variables

+ 0
- 1
modes/rcirc-conf.el View File

@@ -1,6 +1,5 @@
1 1
 ;;; rcirc-conf.el -- Settings for rcirc.
2 2
 (eval-when-compile
3
-  (load "../lisp/functions.el")
4 3
   (require 'cl)
5 4
   (require 'rcirc))
6 5
 

+ 0
- 1
modes/sgml-mode-conf.el View File

@@ -2,7 +2,6 @@
2 2
 ;;; Commentary:
3 3
 ;;; Code:
4 4
 (eval-when-compile
5
-  (load "../lisp/code.el")
6 5
   (require 'company))
7 6
 
8 7
 (defun pjones:sgml-mode-hook ()

+ 0
- 1
modes/simple-conf.el View File

@@ -1,5 +1,4 @@
1 1
 ;;; simple-conf.el -- Functions and settings for simple.el (mostly for
2 2
 ;;; prog-mode since it's defined in simple.el).
3
-(eval-when-compile (load "../lisp/code.el"))
4 3
 (declare-function pjones:add-programming-hook "code.el")
5 4
 (pjones:add-programming-hook 'prog-mode-hook)

+ 0
- 1
modes/speedbar-conf.el View File

@@ -1,6 +1,5 @@
1 1
 ;;; speedbar.el -- quick access to files and tags in a frame.
2 2
 (eval-when-compile
3
-  (load "../lisp/packages.el")
4 3
   (require 'speedbar))
5 4
 
6 5
 (setq speedbar-show-unknown-files t)

+ 0
- 2
modes/yaml-mode-conf.el View File

@@ -1,7 +1,5 @@
1 1
 ;;; yaml-mode-conf.el -- Settings for yaml-mode.
2 2
 (eval-when-compile
3
-  (load "../lisp/packages.el")
4
-  (load "../lisp/code.el")
5 3
   (require 'yaml-mode))
6 4
 
7 5
 (declare-function pjones:add-programming-hook "code.el")

+ 0
- 7
modes/yasnippet-conf.el View File

@@ -1,7 +0,0 @@
1
-;;; yasnippet-conf.el -- Settings for yasnippet.
2
-(eval-when-compile
3
-  (load "../lisp/code.el")
4
-  (require 'yasnippet))
5
-
6
-(custom-set-variables
7
- `(yas-snippet-dirs ,(concat user-emacs-directory "pjones/snippets")))

+ 0
- 11
scripts/check-emacs-output.sh View File

@@ -1,11 +0,0 @@
1
-#!/bin/sh
2
-
3
-clean_output () {
4
-  egrep -v '^(Wrote|Loading)' | \
5
-    egrep -v '^[[:space:]]*$' | \
6
-    egrep -v '^In end of data:' | \
7
-    egrep -v 'org-bookmark-jump-unhide' | \
8
-    egrep -v '^[[:space:]]*be defined at runtime.'
9
-}
10
-
11
-clean_output | wc -l

+ 0
- 16
snippets/GNUmakefile View File

@@ -1,16 +0,0 @@
1
-################################################################################
2
-DEST = ~/.emacs.d/pjones/snippets
3
-FILES = $(shell find . -type f | grep -v GNUmakefile | sed 's|\./||g')
4
-
5
-##############################################################################
6
-.PHONEY: all
7
-
8
-################################################################################
9
-define INSTALL
10
-all: $(DEST)/$(1)
11
-$(DEST)/$(1): $(1)
12
-	install -D -m0640 $$< $$@
13
-endef
14
-
15
-################################################################################
16
-$(foreach f,$(FILES),$(eval $(call INSTALL,$(f))))

+ 0
- 7
snippets/js-mode/function View File

@@ -1,7 +0,0 @@
1
-# -*- mode: snippet; require-final-newline: nil -*-
2
-# name: function
3
-# key: f
4
-# --
5
-function ${1:name}(${2:arg}) {
6
-  $0
7
-}

+ 0
- 3
third-party/GNUmakefile View File

@@ -1,3 +0,0 @@
1
-DEST = ${HOME}/.emacs.d/share/emacs/site-lisp
2
-IGNORE_EMACS_WARNINGS = YES
3
-include ../emacs.mk

+ 0
- 559
third-party/boxquote.el View File

@@ -1,559 +0,0 @@
1
-;;; boxquote.el --- Quote text with a semi-box.
2
-;; Copyright 1999-2008 by Dave Pearson <davep@davep.org>
3
-;; $Revision: 1.19 $
4
-
5
-;; boxquote.el is free software distributed under the terms of the GNU
6
-;; General Public Licence, version 2 or (at your option) any later version.
7
-;; For details see the file COPYING.
8
-
9
-;;; Commentary:
10
-
11
-;; boxquote provides a set of functions for using a text quoting style that
12
-;; partially boxes in the left hand side of an area of text, such a marking
13
-;; style might be used to show externally included text or example code.
14
-;;
15
-;; ,----
16
-;; | The default style looks like this.
17
-;; `----
18
-;;
19
-;; A number of functions are provided for quoting a region, a buffer, a
20
-;; paragraph and a defun. There are also functions for quoting text while
21
-;; pulling it in, either by inserting the contents of another file or by
22
-;; yanking text into the current buffer.
23
-;;
24
-;; The latest version of boxquote.el can be found at:
25
-;;
26
-;;   <URL:http://www.davep.org/emacs/#boxquote.el>
27
-
28
-;;; Thanks:
29
-
30
-;; Kai Grossjohann for inspiring the idea of boxquote. I wrote this code to
31
-;; mimic the "inclusion quoting" style in his Usenet posts. I could have
32
-;; hassled him for his code but it was far more fun to write it myself.
33
-;;
34
-;; Mark Milhollan for providing a patch that helped me get the help quoting
35
-;; functions working with XEmacs.
36
-;;
37
-;; Oliver Much for suggesting the idea of having a `boxquote-kill-ring-save'
38
-;; function.
39
-;;
40
-;; Reiner Steib for suggesting `boxquote-where-is' and the idea of letting
41
-;; `boxquote-describe-key' describe key bindings from other buffers.
42
-
43
-;;; Code:
44
-
45
-;; Things we need:
46
-
47
-(eval-when-compile
48
-  (require 'cl))
49
-(require 'rect)
50
-
51
-;; Attempt to handle older/other emacs.
52
-(eval-and-compile
53
-  
54
-  ;; If customize isn't available just use defvar instead.
55
-  (unless (fboundp 'defgroup)
56
-    (defmacro defgroup  (&rest rest) nil)
57
-    (defmacro defcustom (symbol init docstring &rest rest)
58
-      `(defvar ,symbol ,init ,docstring)))
59
-  
60
-  ;; If `line-beginning-position' isn't available provide one.
61
-  (unless (fboundp 'line-beginning-position)
62
-    (defun line-beginning-position (&optional n)
63
-      "Return the `point' of the beginning of the current line."
64
-      (save-excursion
65
-        (beginning-of-line n)
66
-        (point))))
67
-
68
-  ;; If `line-end-position' isn't available provide one.
69
-  (unless (fboundp 'line-end-position)
70
-    (defun line-end-position (&optional n)
71
-      "Return the `point' of the end of the current line."
72
-      (save-excursion
73
-        (end-of-line n)
74
-        (point)))))
75
-
76
-;; Customize options.
77
-
78
-(defgroup boxquote nil
79
-  "Mark regions of text with a half-box."
80
-  :group  'editing
81
-  :prefix "boxquote-")
82
-
83
-(defcustom boxquote-top-and-tail "----"
84
-  "*Text that will be used at the top and tail of the box."
85
-  :type  'string
86
-  :group 'boxquote)
87
-
88
-(defcustom boxquote-top-corner ","
89
-  "*Text used for the top corner of the box."
90
-  :type  'string
91
-  :group 'boxquote)
92
-
93
-(defcustom boxquote-bottom-corner "`"
94
-  "*Text used for the bottom corner of the box."
95
-  :type  'string
96
-  :group 'boxquote)
97
-
98
-(defcustom boxquote-side "| "
99
-  "*Text used for the side of the box."
100
-  :type  'string
101
-  :group 'boxquote)
102
-
103
-(defcustom boxquote-title-format "[ %s ]"
104
-  "*Format string to use when creating a box title."
105
-  :type  'string
106
-  :group 'boxquote)
107
-
108
-(defcustom boxquote-title-files t
109
-  "*Should a `boxquote-insert-file' title the box with the file name?"
110
-  :type '(choice
111
-          (const :tag "Title the box with the file name" t)
112
-          (const :tag "Don't title the box with the file name" nil))
113
-  :group 'boxquote)
114
-
115
-(defcustom boxquote-file-title-function #'file-name-nondirectory
116
-  "*Function to apply to a file's name when using it to title a box."
117
-  :type  'function
118
-  :group 'boxquote)
119
-
120
-(defcustom boxquote-region-hook nil
121
-  "*Hooks to perform when on a region prior to boxquoting.
122
-
123
-Note that all forms of boxquoting use `boxquote-region' to create the
124
-boxquote. Because of this any hook you place here will be invoked by any of
125
-the boxquoting functions."
126
-  :type  'hook
127
-  :group 'boxquote)
128
-
129
-(defcustom boxquote-yank-hook nil
130
-  "*Hooks to perform on the yanked text prior to boxquoting."
131
-  :type  'hook
132
-  :group 'boxquote)
133
-
134
-(defcustom boxquote-insert-file-hook nil
135
-  "*Hooks to perform on the text from an inserted file prior to boxquoting."
136
-  :type  'hook
137
-  :group 'boxquote)
138
-
139
-(defcustom boxquote-kill-ring-save-title #'buffer-name
140
-  "*Function for working out the title for a `boxquote-kill-ring-save'.
141
-
142
-The string returned from this function will be used as the title for a
143
-boxquote when the saved text is yanked into a buffer with \\[boxquote-yank].
144
-
145
-An example of a non-trivial value for this variable might be:
146
-
147
-  (lambda ()
148
-    (if (string= mode-name \"Article\")
149
-        (aref gnus-current-headers 4)
150
-      (buffer-name)))
151
-
152
-In this case, if you are a `gnus' user, \\[boxquote-kill-ring-save] could be
153
-used to copy text from an article buffer and, when it is yanked into another
154
-buffer using \\[boxquote-yank], the title of the boxquote would be the ID of
155
-the article you'd copied the text from."
156
-  :type  'function
157
-  :group 'boxquote)
158
-
159
-(defcustom boxquote-describe-function-title-format "C-h f %s RET"
160
-  "*Format string to use when formatting a function description box title"
161
-  :type  'string
162
-  :group 'boxquote)
163
-
164
-(defcustom boxquote-describe-variable-title-format "C-h v %s RET"
165
-  "*Format string to use when formatting a variable description box title"
166
-  :type  'string
167
-  :group 'boxquote)
168
-
169
-(defcustom boxquote-describe-key-title-format "C-h k %s"
170
-  "*Format string to use when formatting a key description box title"
171
-  :type  'string
172
-  :group 'boxquote)
173
-
174
-(defcustom boxquote-where-is-title-format "C-h w %s RET"
175
-  "*Format string to use when formatting a `where-is' description box title"
176
-  :type  'string
177
-  :group 'boxquote)
178
-
179
-(defcustom boxquote-where-is-body-format "%s is on %s"
180
-  "*Format string to use when formatting a `where-is' description."
181
-  :type  'string
182
-  :group 'boxquote)
183
-  
184
-;; Main code:
185
-
186
-(defun boxquote-xemacs-p ()
187
-  "Are we running in XEmacs?"
188
-  (and (boundp 'running-xemacs) (symbol-value 'running-xemacs)))
189
-
190
-(defun boxquote-points ()
191
-  "Find the start and end points of a boxquote.
192
-
193
-If `point' is inside a boxquote then a cons is returned, the `car' is the
194
-start `point' and the `cdr' is the end `point'. NIL is returned if no
195
-boxquote is found."
196
-  (save-excursion
197
-    (beginning-of-line)
198
-    (let* ((re-top    (concat "^" (regexp-quote boxquote-top-corner)
199
-                              (regexp-quote boxquote-top-and-tail)))
200
-           (re-left   (concat "^" (regexp-quote boxquote-side)))
201
-           (re-bottom (concat "^" (regexp-quote boxquote-bottom-corner)
202
-                              (regexp-quote boxquote-top-and-tail)))
203
-           (points
204
-            (flet ((find-box-end (re &optional back)
205
-                     (save-excursion
206
-                       (when (if back
207
-                                 (search-backward-regexp re nil t)
208
-                               (search-forward-regexp re nil t))
209
-                         (point)))))
210
-              (cond ((looking-at re-top)
211
-                     (cons (point) (find-box-end re-bottom)))
212
-                    ((looking-at re-left)
213
-                     (cons (find-box-end re-top t) (find-box-end re-bottom)))
214
-                    ((looking-at re-bottom)
215
-                     (cons (find-box-end re-top t) (line-end-position)))))))
216
-      (when (and (car points) (cdr points))
217
-        points))))
218
-
219
-(defun boxquote-quoted-p ()
220
-  "Is `point' inside a boxquote?"
221
-  (not (null (boxquote-points))))
222
-
223
-(defun boxquote-points-with-check ()
224
-  "Get the `boxquote-points' and flag an error of no box was found."
225
-  (or (boxquote-points) (error "I can't see a box here")))
226
-
227
-(defun boxquote-title-format-as-regexp ()
228
-  "Return a regular expression to match the title."
229
-  (with-temp-buffer
230
-    (insert (regexp-quote boxquote-title-format))
231
-    (setf (point) (point-min))
232
-    (when (search-forward "%s" nil t)
233
-      (replace-match ".*" nil t))
234
-    (buffer-string)))
235
-
236
-(defun boxquote-get-title ()
237
-  "Get the title for the current boxquote."
238
-  (multiple-value-bind (prefix-len suffix-len)
239
-      (with-temp-buffer
240
-        (let ((look-for "%s"))
241
-          (insert boxquote-title-format)
242
-          (setf (point) (point-min))
243
-          (search-forward look-for)
244
-          (list (- (point) (length look-for) 1) (- (point-max) (point)))))
245
-    (save-excursion
246
-      (save-restriction
247
-        (boxquote-narrow-to-boxquote)
248
-        (setf (point) (+ (point-min)
249
-                         (length (concat boxquote-top-corner
250
-                                         boxquote-top-and-tail))))
251
-        (if (looking-at (boxquote-title-format-as-regexp))
252
-            (buffer-substring-no-properties (+ (point) prefix-len)
253
-                                            (- (line-end-position) suffix-len))
254
-          "")))))
255
-
256
-;;;###autoload
257
-(defun boxquote-title (title)
258
-  "Set the title of the current boxquote to TITLE.
259
-
260
-If TITLE is an empty string the title is removed. Note that the title will
261
-be formatted using `boxquote-title-format'."
262
-  (interactive (list (read-from-minibuffer "Title: " (boxquote-get-title))))
263
-  (save-excursion
264
-    (save-restriction
265
-      (boxquote-narrow-to-boxquote)
266
-      (setf (point) (+ (point-min)
267
-                       (length (concat boxquote-top-corner
268
-                                       boxquote-top-and-tail))))
269
-      (unless (eolp)
270
-        (kill-line))
271
-      (unless (zerop (length title))
272
-        (insert (format boxquote-title-format title))))))
273
-
274
-;;;###autoload
275
-(defun boxquote-region (start end)
276
-  "Draw a box around the left hand side of a region bounding START and END."
277
-  (interactive "r")
278
-  (save-excursion
279
-    (save-restriction
280
-      (flet ((bol-at-p (n)
281
-               (setf (point) n)
282
-               (bolp))
283
-             (insert-corner (corner pre-break)
284
-               (insert (concat (if pre-break "\n" "")
285
-                               corner boxquote-top-and-tail "\n"))))
286
-        (let ((break-start (not (bol-at-p start)))
287
-              (break-end   (not (bol-at-p end))))
288
-          (narrow-to-region start end)
289
-          (run-hooks 'boxquote-region-hook)
290
-          (setf (point) (point-min))
291
-          (insert-corner boxquote-top-corner break-start)
292
-          (let ((start-point (line-beginning-position)))
293
-            (setf (point) (point-max))
294
-            (insert-corner boxquote-bottom-corner break-end)
295
-            (string-rectangle start-point
296
-                              (progn
297
-                                (setf (point) (point-max))
298
-                                (forward-line -2)
299
-                                (line-beginning-position))
300
-                              boxquote-side)))))))
301
-
302
-;;;###autoload
303
-(defun boxquote-buffer ()
304
-  "Apply `boxquote-region' to a whole buffer."
305
-  (interactive)
306
-  (boxquote-region (point-min) (point-max)))
307
-
308
-;;;###autoload
309
-(defun boxquote-insert-file (filename)
310
-  "Insert the contents of a file, boxed with `boxquote-region'.
311
-
312
-If `boxquote-title-files' is non-nil the boxquote will be given a title that
313
-is the result applying `boxquote-file-title-funciton' to FILENAME."
314
-  (interactive "fInsert file: ")
315
-  (insert (with-temp-buffer
316
-            (insert-file-contents filename nil)
317
-            (run-hooks 'boxquote-insert-file-hook)
318
-            (boxquote-buffer)
319
-            (when boxquote-title-files
320
-              (boxquote-title (funcall boxquote-file-title-function filename)))
321
-            (buffer-string))))
322
-
323
-;;;###autoload
324
-(defun boxquote-kill-ring-save ()
325
-  "Like `kill-ring-save' but remembers a title if possible.
326
-
327
-The title is acquired by calling `boxquote-kill-ring-save-title'. The title
328
-will be used by `boxquote-yank'."
329
-  (interactive)
330
-  (call-interactively #'kill-ring-save)
331
-  (setf (car kill-ring-yank-pointer)
332
-        (format "%S" (list
333
-                      'boxquote-yank-marker
334
-                      (funcall boxquote-kill-ring-save-title)
335
-                      (car kill-ring-yank-pointer)))))
336
-
337
-;;;###autoload
338
-(defun boxquote-yank ()
339
-  "Do a `yank' and box it in with `boxquote-region'.
340
-
341
-If the yanked entry was placed on the kill ring with
342
-`boxquote-kill-ring-save' the resulting boxquote will be titled with
343
-whatever `boxquote-kill-ring-save-title' returned at the time."
344
-  (interactive)
345
-  (save-excursion
346
-    (insert (with-temp-buffer
347
-              (yank)
348
-              (setf (point) (point-min))
349
-              (let ((title
350
-                     (let ((yanked (condition-case nil
351
-                                       (read (current-buffer))
352
-                                     (error nil))))
353
-                       (when (listp yanked)
354
-                         (when (eq (car yanked) 'boxquote-yank-marker)
355
-                           (setf (buffer-string) (nth 2 yanked))
356
-                           (nth 1 yanked))))))
357
-                (run-hooks 'boxquote-yank-hook)
358
-                (boxquote-buffer)
359
-                (when title
360
-                  (boxquote-title title))
361
-                (buffer-string))))))
362
-
363
-;;;###autoload
364
-(defun boxquote-defun ()
365
-  "Apply `boxquote-region' the current defun."
366
-  (interactive)
367
-  (mark-defun)
368
-  (boxquote-region (region-beginning) (region-end)))
369
-
370
-;;;###autoload
371
-(defun boxquote-paragraph ()
372
-  "Apply `boxquote-region' to the current paragraph."
373
-  (interactive)
374
-  (mark-paragraph)
375
-  (boxquote-region (region-beginning) (region-end)))
376
-
377
-;;;###autoload
378
-(defun boxquote-boxquote ()
379
-  "Apply `boxquote-region' to the current boxquote."
380
-  (interactive)
381
-  (let ((box (boxquote-points-with-check)))
382
-    (boxquote-region (car box) (1+ (cdr box)))))
383
-
384
-(defun boxquote-help-buffer-name (item)
385
-  "Return the name of the help buffer associated with ITEM."
386
-  (if (boxquote-xemacs-p)
387
-      (loop for buffer in (symbol-value 'help-buffer-list)
388
-            when (string-match (concat "^*Help:.*`" item "'") buffer)
389
-            return buffer)
390
-    "*Help*"))
391
-
392
-(defun boxquote-quote-help-buffer (help-call title-format item)
393
-  "Perform a help command and boxquote the output.
394
-
395
-HELP-CALL is a function that calls the help command.
396
-
397
-TITLE-FORMAT is the `format' string to use to product the boxquote title.
398
-
399
-ITEM is a function for retrieving the item to get help on."
400
-  (let ((one-window-p (one-window-p)))
401
-    (boxquote-text
402
-     (save-window-excursion
403
-       (funcall help-call)
404
-       (with-current-buffer (boxquote-help-buffer-name (funcall item))
405
-         (buffer-string))))
406
-    (boxquote-title (format title-format (funcall item)))
407
-    (when one-window-p
408
-      (delete-other-windows))))
409
-  
410
-;;;###autoload
411
-(defun boxquote-describe-function ()
412
-  "Call `describe-function' and boxquote the output into the current buffer."
413
-  (interactive)
414
-  (boxquote-quote-help-buffer
415
-   #'(lambda ()
416
-       (call-interactively #'describe-function))
417
-   boxquote-describe-function-title-format
418
-   #'(lambda ()
419
-       (car (if (boxquote-xemacs-p)
420
-                (symbol-value 'function-history)
421
-              minibuffer-history)))))
422
-
423
-;;;###autoload
424
-(defun boxquote-describe-variable ()
425
-  "Call `describe-variable' and boxquote the output into the current buffer."
426
-  (interactive)
427
-  (boxquote-quote-help-buffer
428
-   #'(lambda ()
429
-       (call-interactively #'describe-variable))
430
-   boxquote-describe-variable-title-format
431
-   #'(lambda ()
432
-       (car (if (boxquote-xemacs-p)
433
-                (symbol-value 'variable-history)
434
-              minibuffer-history)))))
435
-
436
-;;;###autoload
437
-(defun boxquote-describe-key (key)
438
-  "Call `describe-key' and boxquote the output into the current buffer.
439
-
440
-If the call to this command is prefixed with \\[universal-argument] you will also be
441
-prompted for a buffer. The key defintion used will be taken from that buffer."
442
-  (interactive "kDescribe key: ")
443
-  (let ((from-buffer (if current-prefix-arg
444
-                         (read-buffer "Buffer: " (current-buffer) t)
445
-                       (current-buffer))))
446
-    (let ((binding
447
-           (with-current-buffer from-buffer
448
-             (key-binding key))))
449
-      (if (or (null binding) (integerp binding))
450
-          (message "%s is undefined" (with-current-buffer from-buffer
451
-                                       (key-description key)))
452
-        (boxquote-quote-help-buffer
453
-         #'(lambda ()
454
-             (with-current-buffer from-buffer
455
-               (describe-key key)))
456
-         boxquote-describe-key-title-format
457
-         #'(lambda ()
458
-             (with-current-buffer from-buffer
459
-               (key-description key))))))))
460
-
461
-;;;###autoload
462
-(defun boxquote-shell-command (command)
463
-  "Call `shell-command' with COMMAND and boxquote the output."
464
-  (interactive (list (read-from-minibuffer "Shell command: " nil nil nil 'shell-command-history)))
465
-  (boxquote-text (with-temp-buffer
466
-                   (shell-command command t)
467
-                   (buffer-string)))
468
-  (boxquote-title command))
469
-
470
-;;;###autoload
471
-(defun boxquote-where-is (definition)
472
-  "Call `where-is' with DEFINITION and boxquote the result."
473
-  (interactive "CCommand: ")
474
-  (boxquote-text (with-temp-buffer
475
-                   (where-is definition t)
476
-                   (format boxquote-where-is-body-format definition (buffer-string))))
477
-  (boxquote-title (format boxquote-where-is-title-format definition)))
478
-
479
-;;;###autoload
480
-(defun boxquote-text (text)
481
-  "Insert TEXT, boxquoted."
482
-  (interactive "sText: ")
483
-  (save-excursion
484
-    (unless (bolp)
485
-      (insert "\n"))
486
-    (insert
487
-     (with-temp-buffer
488
-       (insert text)
489
-       (boxquote-buffer)
490
-       (buffer-string)))))
491
-  
492
-;;;###autoload
493
-(defun boxquote-narrow-to-boxquote ()
494
-  "Narrow the buffer to the current boxquote."
495
-  (interactive)
496
-  (let ((box (boxquote-points-with-check)))
497
-    (narrow-to-region (car box) (cdr box))))
498
-
499
-;;;###autoload
500
-(defun boxquote-narrow-to-boxquote-content ()
501
-  "Narrow the buffer to the content of the current boxquote."
502
-  (interactive)
503
-  (let ((box (boxquote-points-with-check)))
504
-    (narrow-to-region (save-excursion
505
-                        (setf (point) (car box))
506
-                        (forward-line 1)
507
-                        (point))
508
-                      (save-excursion
509
-                        (setf (point) (cdr box))
510
-                        (line-beginning-position)))))
511
-
512
-;;;###autoload
513
-(defun boxquote-kill ()
514
-  "Kill the boxquote and its contents."
515
-  (interactive)
516
-  (let ((box (boxquote-points-with-check)))
517
-    (kill-region (car box) (1+ (cdr box)))))
518
-
519
-;;;###autoload
520
-(defun boxquote-fill-paragraph (arg)
521
-  "Perform a `fill-paragraph' inside a boxquote."
522
-  (interactive "P")
523
-  (if (boxquote-quoted-p)
524
-      (save-restriction
525
-        (boxquote-narrow-to-boxquote-content)
526
-        (let ((fill-prefix boxquote-side))
527
-          (fill-paragraph arg)))
528
-    (fill-paragraph arg)))
529
-  
530
-;;;###autoload
531
-(defun boxquote-unbox-region (start end)
532
-  "Remove a box created with `boxquote-region'."
533
-  (interactive "r")
534
-  (save-excursion
535
-    (save-restriction
536
-      (narrow-to-region start end)
537
-      (setf (point) (point-min))
538
-      (if (looking-at (concat "^" (regexp-quote boxquote-top-corner)
539
-                              (regexp-quote boxquote-top-and-tail)))
540
-          (let ((ends (concat "^[" (regexp-quote boxquote-top-corner)
541
-                              (regexp-quote boxquote-bottom-corner)
542
-                              "]" boxquote-top-and-tail))
543
-                (lines (concat "^" (regexp-quote boxquote-side))))
544
-            (loop while (< (point) (point-max))
545
-                  if (looking-at ends)  do (kill-line t)
546
-                  if (looking-at lines) do (delete-char 2)
547
-                  do (forward-line)))
548
-        (error "I can't see a box here")))))
549
-
550
-;;;###autoload
551
-(defun boxquote-unbox ()
552
-  "Remove the boxquote that contains `point'."
553
-  (interactive)
554
-  (let ((box (boxquote-points-with-check)))
555
-    (boxquote-unbox-region (car box) (1+ (cdr box)))))
556
-
557
-(provide 'boxquote)
558
-
559
-;;; boxquote.el ends here.

+ 0
- 317
third-party/goto-chg.el View File

@@ -1,317 +0,0 @@
1
-;;; goto-chg.el --- goto last change
2
-;;--------------------------------------------------------------------
3
-;;
4
-;; Copyright (C) 2002-2008, David Andersson
5
-;;
6
-;; This program is free software; you can redistribute it and/or
7
-;; modify it under the terms of the GNU General Public License as
8
-;; published by the Free Software Foundation; either version 2 of
9
-;; the License, or (at your option) any later version.
10
-;;
11
-;; This program is distributed in the hope that it will be
12
-;; useful, but WITHOUT ANY WARRANTY; without even the implied
13
-;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14
-;; PURPOSE.  See the GNU General Public License for more details.
15
-;;
16
-;; You should have received a copy of the GNU General Public
17
-;; License along with this program; if not, write to the Free
18
-;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19
-;; MA 02111-1307 USA
20
-;;
21
-;;-------------------------------------------------------------------
22
-;;
23
-;; Author: David Andersson <l.david.andersson(at)sverige.nu>
24
-;; Created: 16 May 2002
25
-;; Version: 1.4
26
-;;
27
-;;; Commentary:
28
-;;
29
-;; Goto Last Change
30
-;;
31
-;; Goto the point of the most recent edit in the buffer.
32
-;; When repeated, goto the second most recent edit, etc.
33
-;; Negative argument, C-u -, for reverse direction.
34
-;; Works by looking into buffer-undo-list to find points of edit.
35
-;;
36
-;; You would probably like to bind this command to a key.
37
-;; For example in your ~/.emacs:
38
-;;
39
-;;   (require 'goto-chg)
40
-;;
41
-;;   (global-set-key [(control ?.)] 'goto-last-change)
42
-;;   (global-set-key [(control ?,)] 'goto-last-change-reverse)
43
-;;
44
-;; Works with emacs-19.29, 19.31, 20.3, 20.7, 21.1, 21.4 and 22.1.
45
-;; Works with XEmacs-20.4 and 21.4 (but see todo about `last-command' below)
46
-;;
47
-;;--------------------------------------------------------------------
48
-;; History
49
-;;
50
-;; Ver 1.4 2008-09-20 David Andersson
51
-;;    Improved property change description; Update comments.
52
-;; Ver 1.3 2007-03-14 David Andersson
53
-;;    Added `goto-last-change-reverse'
54
-;; Ver 1.2 2003-04-06 David Andersson
55
-;;    Don't let repeating error depthen glc-probe-depth.
56
-;; Ver 1.1 2003-04-06 David Andersson
57
-;;    Zero arg describe changes. Negative arg go back.
58
-;;    Autoload. Remove message using nil in stead of an empty string.
59
-;; Ver 1.0 2002-05-18 David Andersson
60
-;;    Initial version
61
-;;
62
-;;--------------------------------------------------------------------
63
-;;
64
-;;todo: Rename "goto-chg.el" -> "gotochange.el" or "goto-chgs" ?
65
-;;todo: Rename function goto-last-change -> goto-last-edit ?
66
-;;todo: Rename adjective "-last-" -> "-latest-" or "-most-recent-" ?
67
-;;todo: There are some, maybe useful, funcs  for region undo 
68
-;;       in simple.el in emacs 20. Take a look.
69
-;;todo: Add functionality to visit changed point in text order, not only in
70
-;;        chronological order. (Naa, highlight-changes-mode does that).
71
-;;todo: Inverse indication that a change has been saved or not
72
-;;todo: Highlight the range of text involved in the last change?
73
-;;todo: Function that goes in reverse direction. Either a function
74
-;;        'goto-next-change' only callable after 'goto-last-change'
75
-;;        or enter a minor mode similar to isearch.
76
-;;todo: See session-jump-to-last-change in session.el?
77
-;;todo: Unhide invisible text (e.g. outline mode) like isearch do.
78
-;;todo: XEmacs sets last-command to `t' after an error, so you cannot reverse
79
-;;        after "No furter change info". Should we bother?
80
-;;todo: Try distinguish "No further change info" (end of truncated undo list)
81
-;;        and "No further changes" (end of a complete undo list).
82
-;;
83
-;;--------------------------------------------------------------------
84
-
85
-;;; Code:
86
-
87
-(defvar glc-default-span 8 "*goto-last-change don't visit the same point twice. glc-default-span tells how far around a visited point not to visit again.")
88
-(defvar glc-current-span 8 "Internal for goto-last-change.\nA copy of glc-default-span or the ARG passed to goto-last-change.")
89
-(defvar glc-probe-depth 0 "Internal for goto-last-change.\nIt is non-zero between successive goto-last-change.")
90
-
91
-;;todo: Find begin and end of line, then use it somewhere
92
-
93
-(defun glc-center-ellipsis (str maxlen &optional ellipsis)
94
-  "Truncate STRING in the middle to length MAXLEN.
95
-If STRING is max MAXLEN just return the string.
96
-Optional third argument is the replacement, which defaults to \"...\"."
97
-  (if (<= (length str) maxlen)
98
-      str
99
-    ;; else
100
-    (let* ((lipsis (or ellipsis "..."))
101
-	   (i (/ (- maxlen (length lipsis)) 2)))
102
-      (concat (substring str 0 i)
103
-	      lipsis 
104
-	      (substring str (- i))))))
105
-
106
-(defun glc-adjust-pos2 (pos p1 p2 adj)
107
-  ;; Helper function to glc-adjust-pos
108
-  (cond ((<= pos (- p1 glc-current-span))
109
-	 pos)
110
-	((> pos (+ p2 glc-current-span))
111
-	 (+ pos adj))
112
-	((zerop glc-current-span)
113
-	 p1)
114
-	(t
115
-	 nil)))
116
-
117
-(defun glc-adjust-pos (pos e)
118
-  "Given POS, a buffer position before the edit E, compute and return
119
-the \"same\" buffer position after E happened.
120
-Exception: return nil if POS is closer than `glc-current-span' to the edit E.
121
-\nInsertion edits before POS returns a larger value.
122
-Deletion edits before POS returns a smaller value.
123
-\nThe edit E is an entry from the `buffer-undo-list'. See for details."
124
-  (cond ((atom e)			; nil==cmd boundary, or, num==changed pos
125
-	 pos)
126
-	((numberp (car e))		; (beg . end)==insertion
127
-	 (glc-adjust-pos2 pos (car e) (car e) (- (cdr e) (car e))))
128
-;; 	 (cond ((< pos (- (car e) glc-current-span)) pos)
129
-;; 	       ((> pos (+ (car e) glc-current-span)) (+ pos (- (cdr e) (car e))))
130
-;; 	       (t nil)))
131
-	((stringp (car e))		; (string . pos)==deletion
132
-	 (glc-adjust-pos2 pos (abs (cdr e)) (+ (abs (cdr e)) (length (car e))) (- (length (car e)))))
133
-;; 	 (cond ((< pos (- (abs (cdr e)) glc-current-span)) pos)
134
-;; 	       ((> pos (+ (abs (cdr e)) (length (car e)) glc-current-span)) (- pos (length (car e))))
135
-;; 	       (t nil)))
136
-	((null (car e))			; (nil prop val beg . end)==prop change
137
-	 (glc-adjust-pos2 pos (nth 3 e) (nthcdr 4 e) 0))
138
-;; 	 (cond ((< pos (- (nth 3 e) glc-current-span)) pos)
139
-;; 	       ((> pos (+ (nthcdr 4 e) glc-current-span)) pos)
140
-;; 	       (t nil)))
141
-	(t				; (marker . dist)==marker moved
142
-	 pos)))
143
-
144
-;; If recursive in stead of iterative (while), it tends to fill the call stack.
145
-;; (Isn't it tail optimized?)
146
-(defun glc-adjust-list (r)
147
-  "R is list of edit entries in chronological order.
148
-Pick the point of the first edit entry and update that point with
149
-the second, third, etc, edit entries. Return the final updated point,
150
-or nil if the point was closer than `glc-current-span' to some edit in R.
151
-\nR is basically a reversed slice from the buffer-undo-list."
152
-  (if r
153
-      ;; Get pos
154
-      (let ((pos (glc-get-pos (car r))))
155
-	(setq r (cdr r))
156
-	;; Walk back in reverse list
157
-	(while (and r pos)
158
-	  (setq pos (glc-adjust-pos pos (car r))
159
-		r (cdr r)))
160
-	pos)
161
-    ;; else
162
-    nil))
163
-
164
-(defun glc-get-pos (e)
165
-  "If E represents an edit, return a position value in E, the position
166
-where the edit took place. Return nil if E represents no real change.
167
-\nE is a entry in the buffer-undo-list."
168
-  (cond ((numberp e) e)			; num==changed position
169
-	((atom e) nil)			; nil==command boundary
170
-	((numberp (car e)) (cdr e))	; (beg . end)==insertion
171
-	((stringp (car e)) (abs (cdr e))) ; (string . pos)==deletion
172
-	((null (car e)) (nthcdr 4 e))	; (nil ...)==text property change
173
-	((atom (car e)) nil)		; (t ...)==file modification time
174
-	(t nil)))			; (marker ...)==marker moved
175
-
176
-(defun glc-get-descript (e &optional n)
177
-  "If E represents an edit, return a short string describing E.
178
-Return nil if E represents no real change.
179
-\nE is a entry in the buffer-undo-list."
180
-  (let ((nn (or (format "T-%d: " n) "")))
181
-    (cond ((numberp e) "New position")	; num==changed position
182
-	  ((atom e) nil)		; nil==command boundary
183
-	  ((numberp (car e))		; (beg . end)==insertion
184
-	   (if (and n (< n 2))
185
-	       (format "%sInserted %d chars \"%s\"" nn (- (cdr e) (car e)) 
186
-		       (glc-center-ellipsis (buffer-substring (car e) (cdr e)) 60))
187
-	     ;; else
188
-	     ;; An older insert. The inserted text cannot easily be computed.
189
-	     ;; Just show the char count.
190
-	     (format "%sInserted %d chars" nn (- (cdr e) (car e)))))
191
-	  ((stringp (car e))		; (string . pos)==deletion
192
-	   (format "%sDeleted \"%s\"" nn (glc-center-ellipsis (car e) 60)))
193
-	  ((null (car e))		; (nil ...)==text property change
194
-	   (format "%sProperty change" nn))
195
-	  ((atom (car e)) nil)		; (t ...)==file modification time
196
-	  (t nil))))			; (marker ...)==marker moved
197
-
198
-(defun glc-is-positionable (e)
199
-  "Return non-nil if E is an insertion, deletion or text property change.
200
-\nE is a entry in the buffer-undo-list."
201
-  (and (not (numberp e)) (glc-get-pos e)))
202
-
203
-(defun glc-is-filetime (e)
204
-  "Return t if E indicates a buffer became \"modified\",
205
-that is, it was previously saved or unchanged. Nil otherwise."
206
-  (and (listp e) (eq (car e) t)))
207
-
208
-;;;###autoload
209
-(defun goto-last-change (arg)
210
-"Go to the point where the last edit was made in the current buffer.
211
-Repeat the command to go to the second last edit, etc.
212
-A preceding \\[universal-argument] - (minus) will reverse direction for the next command in
213
-the sequence, to go back to a more recent edit.
214
-\nIt does not go to the same point twice even if there has been many edits
215
-there. I call the minimal distance between distinguishable edits \"span\".
216
-Set variable `glc-default-span' to control how close is \"the same point\".
217
-Default span is 8.
218
-The span can be changed temporarily with \\[universal-argument] right before \\[goto-last-change]:
219
-\\[universal-argument] <NUMBER> set current span to that number,
220
-\\[universal-argument] (no number) multiplies span by 4, starting with default.
221
-The so set span remains until it is changed again with \\[universal-argument], or the consecutive
222
-repetition of this command is ended by any other command.
223
-\nWhen span is zero (i.e. \\[universal-argument] 0) subsequent \\[goto-last-change] visits each and
224
-every point of edit and a message shows what change was made there.
225
-In this case it may go to the same point twice.
226
-\nThis command uses undo information. If undo is disabled, so is this command.
227
-At times, when undo information becomes too large, the oldest information is
228
-discarded. See variable `undo-limit'."
229
-  (interactive "P")
230
-  (cond ((not (eq this-command last-command))
231
-	 ;; Start a glc sequence
232
-	 ;; Don't go to current point if last command was an obvious edit
233
-	 ;; (yank or self-insert, but not kill-region). Makes it easier to
234
-	 ;; jump back and forth when copying seleced lines.
235
-	 (setq glc-probe-depth (if (memq last-command '(yank self-insert-command)) 1 0)
236
-	       glc-direction 1
237
-	       glc-current-span glc-default-span)
238
-	 (if (< (prefix-numeric-value arg) 0)
239
-	     (error "Negative arg: Cannot reverse as the first operation"))))
240
-  (cond ((null buffer-undo-list)
241
-	 (error "Buffer has not been changed"))
242
-	((eq buffer-undo-list t)
243
-	 (error "No change info (undo is disabled)")))
244
-  (cond ((numberp arg)			; Numeric arg sets span
245
-	 (setq glc-current-span (abs arg)))
246
-	((consp arg)			; C-u's multiply previous span by 4
247
-	 (setq glc-current-span (* (abs (car arg)) glc-default-span))
248
-	 (message "Current span is %d chars" glc-current-span))) ;todo: keep message with "waiting" and "is saved"
249
-  (cond ((< (prefix-numeric-value arg) 0)
250
-	 (setq glc-direction -1))
251
-	(t
252
-	 (setq glc-direction 1)))
253
-  (let (rev				; Reversed (and filtered) undo list
254
-	pos				; The pos we look for, nil until found
255
-	(n 0)				; Steps in undo list (length of 'rev')
256
-	(l buffer-undo-list) 
257
-	(passed-save-entry (not (buffer-modified-p)))
258
-	(new-probe-depth glc-probe-depth))
259
-    ;; Walk back and forth in the buffer-undo-list, each time one step deeper,
260
-    ;; until we can walk back the whole list with a 'pos' that is not coming
261
-    ;; too close to another edit.
262
-    (while (null pos)
263
-      (setq new-probe-depth (+ new-probe-depth glc-direction))
264
-      (if (< glc-direction 0)
265
-	  (setq rev ()
266
-		n 0
267
-		l buffer-undo-list
268
-		passed-save-entry (not (buffer-modified-p))))
269
-      (if (< new-probe-depth 1)
270
-	  (error "No later change info"))
271
-      (if (> n 150)
272
-	  (message "working..."))
273
-      ;; Walk forward in buffer-undo-list, glc-probe-depth steps.
274
-      ;; Build reverse list along the way
275
-      (while (< n new-probe-depth)
276
-	(cond ((null l)
277
-	       ;(setq this-command t)	; Disrupt repeat sequence
278
-	       (error "No further change info"))
279
-	      ((glc-is-positionable (car l))
280
-	       (setq n (1+ n)
281
-		     rev (cons (car l) rev)))
282
-	      ((or passed-save-entry (glc-is-filetime (car l)))
283
-	       (setq passed-save-entry t)))
284
-	(setq l (cdr l)))
285
-      ;; Walk back in reverse list, from older to newer edits.
286
-      ;; Adjusting pos along the way.
287
-      (setq pos (glc-adjust-list rev)))
288
-    ;; Found a place not previously visited, in 'pos'.
289
-    ;; (An error have been issued if nothing (more) found.)
290
-    (if (> n 150)
291
-	(message nil))			; remove message "working..."
292
-    (if (and (= glc-current-span 0) (glc-get-descript (car rev) n))
293
-	(message "%s" (glc-get-descript (car rev) n))
294
-      ;; else
295
-      (if passed-save-entry
296
-	  (message "(This change is saved)")))
297
-    (setq glc-probe-depth new-probe-depth)
298
-    (goto-char pos)))
299
-
300
-;; ;;;###autoload
301
-(defun goto-last-change-reverse (arg)
302
-  (interactive "P")
303
-  ;; Negate arg, all kinds
304
-  (cond ((eq arg nil)  (setq arg '-))
305
-	((eq arg '-)   (setq arg nil))
306
-	((listp arg)   (setq arg (list (- (car arg)))))
307
-	(t (setq arg   (- arg))))
308
-  ;; Make 'goto-last-change-reverse' look like 'goto-last-change'
309
-  (cond ((eq last-command this-command)
310
-	 (setq last-command 'goto-last-change)))
311
-  (setq this-command 'goto-last-change)
312
-  ;; Call 'goto-last-change' to do the job
313
-  (goto-last-change arg))
314
-
315
-(provide 'goto-chg)
316
-
317
-;;; goto-chg.el ends here

+ 0
- 919
third-party/graphviz-dot-mode.el View File

@@ -1,919 +0,0 @@
1
-;;; graphviz-dot-mode.el --- Mode for the dot-language used by graphviz (att).
2
-
3
-;; Copyright (C) 2002 - 2005 Pieter Pareit <pieter.pareit@scarlet.be>
4
-
5
-;; This program is free software; you can redistribute it and/or
6
-;; modify it under the terms of the GNU General Public License as
7
-;; published by the Free Software Foundation; either version 2 of
8
-;; the License, or (at your option) any later version.
9
-
10
-;; This program is distributed in the hope that it will be
11
-;; useful, but WITHOUT ANY WARRANTY; without even the implied
12
-;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13
-;; PURPOSE.  See the GNU General Public License for more details.
14
-
15
-;; You should have received a copy of the GNU General Public
16
-;; License along with this program; if not, write to the Free
17
-;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18
-;; MA 02111-1307 USA
19
-
20
-;; Authors: Pieter Pareit <pieter.pareit@scarlet.be>
21
-;;          Rubens Ramos <rubensr AT users.sourceforge.net>
22
-;; Maintainer: Pieter Pareit <pieter.pareit@planetinternet.be>
23
-;; Homepage: http://users.skynet.be/ppareit/projects/graphviz-dot-mode/graphviz-dot-mode.html
24
-;; Created: 28 Oct 2002
25
-;; Last modified: 15 Feb 2005
26
-;; Version: 0.3.3
27
-;; Keywords: mode dot dot-language dotlanguage graphviz graphs att
28
-
29
-;;; Commentary:
30
-;; Use this mode for editing files in the dot-language (www.graphviz.org and
31
-;; http://www.research.att.com/sw/tools/graphviz/).
32
-;;
33
-;; To use graphviz-dot-mode, add 
34
-;; (load-file "PATH_TO_FILE/graphviz-dot-mode.el") 
35
-;; to your ~/.emacs(.el) or ~/.xemacs/init.el
36
-;;
37
-;; The graphviz-dot-mode will do font locking, indentation, preview of graphs
38
-;; and eases compilation/error location. There is support for both GNU Emacs
39
-;; and XEmacs.
40
-;;
41
-;; Font locking is automatic, indentation uses the same commands as
42
-;; other modes, tab, M-j and C-M-q.  Insertion of comments uses the
43
-;; same commands as other modes, M-; .  You can compile a file using
44
-;; M-x compile or C-c c, after that M-x next-error will also work.
45
-;; There is support for viewing an generated image with C-c p.
46
-
47
-;;; Todo:
48
-;; * cleanup the mess of graphviz-dot-compilation-parse-errors
49
-;; * electric indentation is fundamentally broken, because 
50
-;;   {...} are also used for record nodes. You could argue, I suppose, that 
51
-;;   many diagrams don't need those, but it would be worth having a note (and 
52
-;;   it makes sense that the default is now for electric indentation to be 
53
-;;   off).
54
-
55
-;;; History:
56
-
57
-;; Version 0.3.4 bug fixes
58
-;; 24/02/2005: * fixed a bug in graphviz-dot-preview
59
-;; Version 0.3.3 bug fixes
60
-;; 13/02/2005: Reuben Thomas <rrt AT sc3d.org>
61
-;;             * add graphviz-dot-indent-width
62
-;; Version 0.3.2 bug fixes
63
-;; 25/03/2004: Rubens Ramos <rubensr AT users.sourceforge.net>
64
-;;             * semi-colons and brackets are added when electric
65
-;;               behaviour is disabled.
66
-;;             * electric characters do not behave electrically inside
67
-;;               comments or strings.
68
-;;             * default for electric-braces is disabled now (makes more
69
-;;               sense I guess).
70
-;;             * using read-from-minibuffer instead of read-shell-command
71
-;;               for emacs.
72
-;;             * Fixed test for easymenu, so that it works on older
73
-;;               versions of XEmacs.
74
-;;             * Fixed indentation error when trying to indent last brace
75
-;;               of an empty graph.
76
-;;             * region-active-p does not exist in emacs (21.2 at least),
77
-;;               so removed from code
78
-;;             * Added uncomment menu option
79
-;; Version 0.3.1 bug fixes
80
-;; 03/03/2004: * backward-word needs argument for older emacs
81
-;; Version 0.3 added features and fixed bugs
82
-;; 10/01/2004: fixed a bug in graphviz-dot-indent-graph
83
-;; 08/01/2004: Rubens Ramos <rubensr AT users.sourceforge.net>
84
-;;             * added customization support
85
-;;             * Now it works on XEmacs and Emacs
86
-;;             * Added support to use an external Viewer
87
-;;             * Now things do not break when dot mode is entered
88
-;;               when there is no buffer name, but the side effect is
89
-;;               that in this case, the compilation command is not
90
-;;               correct.
91
-;;             * Preview works on XEmacs and emacs.
92
-;;             * Electric indentation on newline
93
-;;             * Minor changes to indentation
94
-;;             * Added keyword completion (but could be A LOT better)
95
-;;             * There are still a couple of ugly hacks. Look for 'RR'.
96
-;; Version 0.2 added features
97
-;; 11/11/2002: added preview support.
98
-;; 10/11/2002: indent a graph or subgraph at once with C-M-q.
99
-;; 08/11/2002: relaxed rules for indentation, the may now be extra chars
100
-;;             after beginning of graph (comment's for example).
101
-;; Version 0.1.2 bug fixes and naming issues
102
-;; 06/11/2002: renamed dot-font-lock-defaults to dot-font-lock-keywords.
103
-;;             added some documentation to dot-colors.
104
-;;             provided a much better way to handle my max-specpdl-size
105
-;;             problem.
106
-;;             added an extra autoload cookie (hope this helps, as I don't
107
-;;             yet use autoload myself)
108
-;; Version 0.1.1 bug fixes
109
-;; 06/11/2002: added an missing attribute, for font-locking to work.
110
-;;             fixed the regex generating, so that it only recognizes
111
-;;             whole words
112
-;; 05/11/2002: there can now be extra white space chars after an '{'.
113
-;; 04/11/2002: Why I use max-specpdl-size is now documented, and old value
114
-;;             gets restored.
115
-;; Version 0.1 initial release
116
-;; 02/11/2002: implemented parser for *compilation* of a .dot file.
117
-;; 01/11/2002: implemented compilation of an .dot file.
118
-;; 31/10/2002: added syntax-table to the mode.
119
-;; 30/10/2002: implemented indentation code.
120
-;; 29/10/2002: implemented all of font-lock.
121
-;; 28/10/2002: derived graphviz-dot-mode from fundamental-mode, started 
122
-;;             implementing font-lock.
123
-
124
-;;; Code:
125
-
126
-(defconst graphviz-dot-mode-version "0.3.3"
127
-  "Version of `graphviz-dot-mode.el'.")
128
-
129
-(defgroup graphviz nil
130
-  "Major mode for editing Graphviz Dot files"
131
-  :group 'tools)
132
-
133
-(defun graphviz-dot-customize ()
134
-  "Run \\[customize-group] for the `graphviz' group."
135
-  (interactive)
136
-  (customize-group 'graphviz))
137
-
138
-(defvar graphviz-dot-mode-abbrev-table nil
139
-  "Abbrev table in use in Graphviz Dot mode buffers.")
140
-(define-abbrev-table 'graphviz-dot-mode-abbrev-table ())
141
-
142
-(defcustom graphviz-dot-dot-program "dot"
143
-  "*Location of the dot program. This is used by `compile'."
144
-  :type 'string
145
-  :group 'graphviz)
146
-
147
-(defcustom graphviz-dot-view-command "doted %s"
148
-  "*External program to run on the buffer. You can use `%s' in this string,
149
-and it will be substituted by the buffer name."
150
-  :type 'string
151
-  :group 'graphviz)
152
-
153
-(defcustom graphviz-dot-view-edit-command nil
154
-  "*Whether to allow the user to edit the command to run an external
155
-viewer."
156
-  :type 'boolean
157
-  :group 'graphviz)
158
-
159
-(defcustom graphviz-dot-save-before-view t
160
-  "*If not nil, M-x graphviz-dot-view saves the current buffer before running
161
-the command."
162
-  :type 'boolean
163
-  :group 'graphviz)
164
-
165
-(defcustom graphviz-dot-auto-indent-on-newline t
166
-  "*If not nil, `electric-graphviz-dot-terminate-line' is executed in a line is terminated."
167
-  :type 'boolean
168
-  :group 'graphviz)
169
-
170
-(defcustom graphviz-dot-indent-width default-tab-width
171
-  "*Indentation width in Graphviz Dot mode buffers."
172
-  :type 'integer
173
-  :group 'graphviz)
174
-
175
-(defcustom graphviz-dot-auto-indent-on-braces nil
176
-  "*If not nil, `electric-graphviz-dot-open-brace' and `electric-graphviz-dot-close-brace' are executed when { or } are typed"
177
-  :type 'boolean
178
-  :group 'graphviz)
179
-
180
-(defcustom graphviz-dot-auto-indent-on-semi t
181
-  "*If not nil, `electric-graphviz-dot-semi' is executed when semicolon is typed"
182
-  :type 'boolean
183
-  :group 'graphviz)
184
-
185
-(defcustom graphviz-dot-preview-extension "png"
186
-  "*The extension to use for the compilation and preview commands. The format
187
-for the compilation command is 
188
-`dot -T<extension> file.dot > file.<extension>'."
189
-  :type 'string
190
-  :group 'graphviz)
191
-
192
-(defcustom graphviz-dot-toggle-completions nil
193
-  "*Non-nil means that repeated use of \
194
-\\<graphviz-dot-mode-map>\\[graphviz-dot-complete-word] will toggle the possible
195
-completions in the minibuffer.  Normally, when there is more than one possible
196
-completion, a buffer will display all completions."
197
-  :type 'boolean
198
-  :group 'graphviz)
199
-
200
-(defcustom graphviz-dot-delete-completions nil
201
-  "*Non-nil means that the completion buffer is automatically deleted when a
202
-key is pressed."
203
-  :type 'boolean
204
-  :group 'graphviz)
205
-
206
-(defcustom graphviz-dot-attr-keywords 
207
-  '("graph" "digraph" "subgraph" "node" "edge" "strict" "rankdir"
208
-    "size" "page" "Damping" "Epsilon" "URL" "arrowhead" "arrowsize"
209
-    "arrowtail" "bb" "bgcolor" "bottomlabel" "center" "clusterrank"
210
-    "color" "comment" "compound" "concentrate" "constraint" "decorate"
211
-    "dim" "dir" "distortion" "fillcolor" "fixedsize" "fontcolor"
212
-    "fontname" "fontpath" "fontsize" "group" "headURL" "headlabel"
213
-    "headport" "height" "label" "labelangle" "labeldistance" "labelfloat"
214
-    "labelfontcolor" "labelfontname" "labelfontsize" "labeljust"
215
-    "labelloc" "layer" "layers" "len" "lhead" "lp" "ltail" "margin"
216
-    "maxiter" "mclimit" "minlen" "model" "nodesep" "normalize" "nslimit"
217
-    "nslimit1" "ordering" "orientation" "overlap" "pack" "pagedir"
218
-    "pencolor" "peripheries" "pin" "pos" "quantum" "rank" "ranksep"
219
-    "ratio" "rects" "regular" "remincross" "rotate" "samehead" "sametail"
220
-    "samplepoint" "searchsize" "sep" "shape" "shapefile" "showboxes"
221
-    "sides" "skew" "splines" "start" "style" "stylesheet" "tailURL"
222
-    "taillabel" "tailport" "toplabel" "vertices" "voro_margin" "weight"
223
-    "z")
224
-  "*Keywords for attribute names in a graph. This is used by the auto
225
-completion code. The actual completion tables are built when the mode
226
-is loaded, so changes to this are not immediately visible."
227
-  :type '(repeat (string :tag "Keyword"))
228
-  :group 'graphviz)
229
-
230
-(defcustom graphviz-dot-value-keywords 
231
-  '("true" "false" "normal" "inv" "dot" "invdot" "odot" "invodot"
232
-    "none" "tee" "empty" "invempty" "diamond" "odiamond" "box" "obox"
233
-    "open" "crow" "halfopen" "local" "global" "none" "forward" "back"
234
-    "both" "none" "BL" "BR" "TL" "TR" "RB" "RT" "LB" "LT" ":n" ":ne" ":e"
235
-    ":se" ":s" ":sw" ":w" ":nw" "same" "min" "source" "max" "sink" "LR"
236
-    "box" "polygon" "ellipse" "circle" "point" "egg" "triangle"
237
-    "plaintext" "diamond" "trapezium" "parallelogram" "house" "hexagon"
238
-    "octagon" "doublecircle" "doubleoctagon" "tripleoctagon" "invtriangle"
239
-    "invtrapezium" "invhouse" "Mdiamond" "Msquare" "Mcircle" "record"
240
-    "Mrecord" "dashed" "dotted" "solid" "invis" "bold" "filled"
241
-    "diagonals" "rounded" ) 
242
-  "*Keywords for attribute values. This is used by the auto completion
243
-code. The actual completion tables are built when the mode is loaded,
244
-so changes to this are not immediately visible."
245
-  :type '(repeat (string :tag "Keyword")) 
246
-  :group 'graphviz)
247
-
248
-;;; Font-locking:
249
-(defvar graphviz-dot-colors-list
250
-  '(aliceblue antiquewhite antiquewhite1 antiquewhite2
251
-        antiquewhite3 antiquewhite4 aquamarine aquamarine1
252
-        aquamarine2 aquamarine3 aquamarine4 azure azure1
253
-        azure2 azure3 azure4 beige bisque bisque1 bisque2
254
-        bisque3 bisque4 black blanchedalmond blue blue1
255
-        blue2 blue3 blue4 blueviolet brown brown1 brown2
256
-        brown3 brown4 burlywood burlywood1 burlywood2
257
-        burlywood3 burlywood4 cadetblue cadetblue1
258
-        cadetblue2 cadetblue3 cadetblue4 chartreuse
259
-        chartreuse1 chartreuse2 chartreuse3 chartreuse4
260
-        chocolate chocolate1 chocolate2 chocolate3 chocolate4
261
-        coral coral1 coral2 coral3 coral4 cornflowerblue
262
-        cornsilk cornsilk1 cornsilk2 cornsilk3 cornsilk4
263
-        crimson cyan cyan1 cyan2 cyan3 cyan4 darkgoldenrod
264
-        darkgoldenrod1 darkgoldenrod2 darkgoldenrod3
265
-        darkgoldenrod4 darkgreen darkkhaki darkolivegreen
266
-        darkolivegreen1 darkolivegreen2 darkolivegreen3
267
-        darkolivegreen4 darkorange darkorange1 darkorange2
268
-        darkorange3 darkorange4 darkorchid darkorchid1
269
-        darkorchid2 darkorchid3 darkorchid4 darksalmon
270
-        darkseagreen darkseagreen1 darkseagreen2
271
-        darkseagreen3 darkseagreen4 darkslateblue
272
-        darkslategray darkslategray1 darkslategray2
273
-        darkslategray3  darkslategray4 darkslategrey
274
-        darkturquoise darkviolet deeppink deeppink1
275
-        deeppink2 deeppink3 deeppink4 deepskyblue
276
-        deepskyblue1 deepskyblue2 deepskyblue3 deepskyblue4
277
-        dimgray dimgrey  dodgerblue dodgerblue1 dodgerblue2
278
-        dodgerblue3  dodgerblue4 firebrick firebrick1
279
-        firebrick2 firebrick3 firebrick4 floralwhite
280
-        forestgreen gainsboro ghostwhite gold gold1 gold2
281
-        gold3 gold4 goldenrod goldenrod1 goldenrod2
282
-        goldenrod3 goldenrod4 gray gray0 gray1 gray10 gray100
283
-        gray11 gray12 gray13 gray14 gray15 gray16 gray17
284
-        gray18 gray19 gray2 gray20 gray21 gray22 gray23
285
-        gray24 gray25 gray26 gray27 gray28 gray29 gray3
286
-        gray30 gray31 gray32 gray33 gray34 gray35 gray36
287
-        gray37 gray38 gray39 gray4 gray40 gray41 gray42
288
-        gray43 gray44 gray45 gray46 gray47 gray48 gray49
289
-        gray5 gray50 gray51 gray52 gray53 gray54 gray55
290
-        gray56 gray57 gray58 gray59 gray6 gray60 gray61
291
-        gray62 gray63 gray64 gray65 gray66 gray67 gray68
292
-        gray69 gray7 gray70 gray71 gray72 gray73 gray74
293
-        gray75 gray76 gray77 gray78 gray79 gray8 gray80
294
-        gray81 gray82 gray83 gray84 gray85 gray86 gray87
295
-        gray88 gray89 gray9 gray90 gray91 gray92 gray93
296
-        gray94 gray95 gray96 gray97 gray98 gray99 green
297
-        green1 green2 green3 green4 greenyellow grey grey0
298
-        grey1 grey10 grey100 grey11 grey12 grey13 grey14
299
-        grey15 grey16 grey17 grey18 grey19 grey2 grey20
300
-        grey21 grey22 grey23 grey24 grey25 grey26 grey27
301
-        grey28 grey29 grey3 grey30 grey31 grey32 grey33
302
-        grey34 grey35 grey36 grey37 grey38 grey39 grey4
303
-        grey40 grey41 grey42 grey43 grey44 grey45 grey46
304
-        grey47 grey48 grey49 grey5 grey50 grey51 grey52
305
-        grey53 grey54 grey55 grey56 grey57 grey58 grey59
306
-        grey6 grey60 grey61 grey62 grey63 grey64 grey65
307
-        grey66 grey67 grey68 grey69 grey7 grey70 grey71
308
-        grey72 grey73 grey74 grey75 grey76 grey77 grey78
309
-        grey79 grey8 grey80 grey81 grey82 grey83 grey84
310
-        grey85 grey86 grey87 grey88 grey89 grey9 grey90
311
-        grey91 grey92 grey93 grey94 grey95 grey96 grey97
312
-        grey98 grey99 honeydew honeydew1 honeydew2 honeydew3
313
-        honeydew4 hotpink hotpink1 hotpink2 hotpink3 hotpink4
314
-        indianred indianred1 indianred2 indianred3 indianred4
315
-        indigo ivory ivory1 ivory2 ivory3 ivory4 khaki khaki1
316
-        khaki2 khaki3 khaki4 lavender lavenderblush
317
-        lavenderblush1 lavenderblush2 lavenderblush3
318
-        lavenderblush4 lawngreen lemonchiffon lemonchiffon1
319
-        lemonchiffon2 lemonchiffon3 lemonchiffon4 lightblue
320
-        lightblue1 lightblue2 lightblue3 lightblue4
321
-        lightcoral lightcyan lightcyan1 lightcyan2 lightcyan3
322
-        lightcyan4 lightgoldenrod lightgoldenrod1
323
-        lightgoldenrod2 lightgoldenrod3 lightgoldenrod4
324
-        lightgoldenrodyellow lightgray lightgrey lightpink
325
-        lightpink1 lightpink2 lightpink3 lightpink4
326
-        lightsalmon lightsalmon1 lightsalmon2 lightsalmon3
327
-        lightsalmon4 lightseagreen lightskyblue lightskyblue1
328
-        lightskyblue2 lightskyblue3 lightskyblue4
329
-        lightslateblue lightslategray lightslategrey
330
-        lightsteelblue lightsteelblue1 lightsteelblue2
331
-        lightsteelblue3 lightsteelblue4 lightyellow
332
-        lightyellow1 lightyellow2 lightyellow3 lightyellow4
333
-        limegreen linen magenta magenta1 magenta2 magenta3
334
-        magenta4 maroon maroon1 maroon2 maroon3 maroon4
335
-        mediumaquamarine mediumblue  mediumorchid
336
-        mediumorchid1 mediumorchid2 mediumorchid3
337
-        mediumorchid4 mediumpurple mediumpurple1
338
-        mediumpurple2 mediumpurple3 mediumpurple4
339
-        mediumseagreen mediumslateblue mediumspringgreen
340
-        mediumturquoise mediumvioletred midnightblue
341
-        mintcream mistyrose mistyrose1 mistyrose2 mistyrose3
342
-        mistyrose4 moccasin navajowhite navajowhite1
343
-        navajowhite2 navajowhite3 navajowhite4 navy navyblue
344
-        oldlace olivedrab olivedrap olivedrab1 olivedrab2
345
-        olivedrap3 oragne palegoldenrod palegreen palegreen1
346
-        palegreen2 palegreen3 palegreen4 paleturquoise
347
-        paleturquoise1 paleturquoise2 paleturquoise3
348
-        paleturquoise4 palevioletred palevioletred1
349
-        palevioletred2 palevioletred3 palevioletred4
350
-        papayawhip peachpuff peachpuff1 peachpuff2
351
-        peachpuff3 peachpuff4 peru pink pink1 pink2 pink3
352
-        pink4 plum plum1 plum2 plum3 plum4 powderblue
353
-        purple purple1 purple2 purple3 purple4 red red1 red2
354
-        red3 red4 rosybrown rosybrown1 rosybrown2 rosybrown3
355
-        rosybrown4 royalblue royalblue1 royalblue2 royalblue3
356
-        royalblue4 saddlebrown salmon salmon1 salmon2 salmon3
357
-        salmon4 sandybrown seagreen seagreen1 seagreen2
358
-        seagreen3 seagreen4 seashell seashell1 seashell2
359
-        seashell3 seashell4 sienna sienna1 sienna2 sienna3
360
-        sienna4 skyblue skyblue1 skyblue2 skyblue3 skyblue4
361
-        slateblue slateblue1 slateblue2 slateblue3 slateblue4
362
-        slategray slategray1 slategray2 slategray3 slategray4
363
-        slategrey snow snow1 snow2 snow3 snow4 springgreen
364
-        springgreen1 springgreen2 springgreen3 springgreen4
365
-        steelblue steelblue1 steelblue2 steelblue3 steelblue4
366
-        tan tan1 tan2 tan3 tan4 thistle thistle1 thistle2
367
-        thistle3 thistle4 tomato tomato1 tomato2 tomato3
368
-        tomato4 transparent turquoise turquoise1 turquoise2
369
-        turquoise3 turquoise4 violet violetred violetred1
370
-        violetred2 violetred3 violetred4 wheat wheat1 wheat2
371
-        wheat3 wheat4 white whitesmoke yellow yellow1 yellow2
372
-        yellow3 yellow4 yellowgreen)
373
-  "Possible color constants in the dot language.
374
-The list of constant is available at http://www.research.att.com/~erg/graphviz\
375
-/info/colors.html")
376
-
377
-
378
-(defvar graphviz-dot-color-keywords
379
-  (mapcar 'symbol-name graphviz-dot-colors-list))
380
-
381
-(defvar graphviz-attr-keywords
382
-  (mapcar '(lambda (elm) (cons elm 0)) graphviz-dot-attr-keywords))
383
-
384
-(defvar graphviz-value-keywords
385
-  (mapcar '(lambda (elm) (cons elm 0)) graphviz-dot-value-keywords))
386
-
387
-(defvar graphviz-color-keywords
388
-  (mapcar '(lambda (elm) (cons elm 0)) graphviz-dot-color-keywords))
389
-
390
-;;; Key map
391
-(defvar graphviz-dot-mode-map ()
392
-  "Keymap used in Graphviz Dot mode.")
393
-
394
-(if graphviz-dot-mode-map
395
-    ()
396
-  (let ((map (make-sparse-keymap)))
397
-    (define-key map "\r"       'electric-graphviz-dot-terminate-line)
398
-    (define-key map "{"        'electric-graphviz-dot-open-brace)
399
-    (define-key map "}"        'electric-graphviz-dot-close-brace)
400
-    (define-key map ";"        'electric-graphviz-dot-semi)
401
-    (define-key map "\M-\t"    'graphviz-dot-complete-word)
402
-    (define-key map "\C-\M-q"  'graphviz-dot-indent-graph)
403
-    (define-key map "\C-cp"    'graphviz-dot-preview)
404
-    (define-key map "\C-cc"    'compile)
405
-    (define-key map "\C-cv"    'graphviz-dot-view)
406
-    (define-key map "\C-c\C-c" 'comment-region)
407
-    (define-key map "\C-c\C-u" 'graphviz-dot-uncomment-region)
408
-    (setq graphviz-dot-mode-map map)
409
-    ))
410
-
411
-;;; Syntax table
412
-(defvar graphviz-dot-mode-syntax-table nil
413
-  "Syntax table for `graphviz-dot-mode'.")
414
-
415
-(if graphviz-dot-mode-syntax-table
416
-    ()
417
-  (let ((st (make-syntax-table)))
418
-    (modify-syntax-entry ?/  ". 124b" st)
419
-    (modify-syntax-entry ?*  ". 23"   st)
420
-    (modify-syntax-entry ?\n "> b"    st)
421
-    (modify-syntax-entry ?=  "."      st)
422
-    (modify-syntax-entry ?_  "_"      st)
423
-    (modify-syntax-entry ?-  "_"      st)
424
-    (modify-syntax-entry ?>  "."      st)
425
-    (modify-syntax-entry ?[  "("      st)
426
-    (modify-syntax-entry ?]  ")"      st)
427
-    (modify-syntax-entry ?\" "\""     st)
428
-    (setq graphviz-dot-mode-syntax-table st)
429
-  ))
430
-
431
-(defvar graphviz-dot-font-lock-keywords
432
-  `(("\\(:?di\\|sub\\)?graph \\(\\sw+\\)"
433
-     (2 font-lock-function-name-face))
434
-    (,(regexp-opt graphviz-dot-value-keywords 'words)
435
-     . font-lock-reference-face)
436
-    ;; to build the font-locking for the colors,
437
-    ;; we need more room for max-specpdl-size,
438
-    ;; after that we take the list of symbols,
439
-    ;; convert them to a list of strings, and make
440
-    ;; an optimized regexp from them
441
-    (,(let ((max-specpdl-size (max max-specpdl-size 1200)))
442
-  (regexp-opt graphviz-dot-color-keywords))
443
-     . font-lock-string-face)
444
-    (,(concat
445
-       (regexp-opt graphviz-dot-attr-keywords 'words)
446
-       "[ \\t\\n]*=")
447
-     ;; RR - ugly, really, but I dont know why xemacs does not work
448
-     ;; if I change the next car to "1"...
449
-     (0 font-lock-variable-name-face)))
450
-  "Keyword highlighting specification for `graphviz-dot-mode'.")
451
-
452
-;;;###autoload
453
-(defun graphviz-dot-mode ()
454
-  "Major mode for the dot language. \\<graphviz-dot-mode-map> 
455
-TAB indents for graph lines. 
456
-
457
-\\[graphviz-dot-indent-graph]\t- Indentaion function.
458
-\\[graphviz-dot-preview]\t- Previews graph in a buffer.
459
-\\[graphviz-dot-view]\t- Views graph in an external viewer.
460
-\\[graphviz-dot-indent-line]\t- Indents current line of code.
461
-\\[graphviz-dot-complete-word]\t- Completes the current word.
462
-\\[electric-graphviz-dot-terminate-line]\t- Electric newline.
463
-\\[electric-graphviz-dot-open-brace]\t- Electric open braces.
464
-\\[electric-graphviz-dot-close-brace]\t- Electric close braces.
465
-\\[electric-graphviz-dot-semi]\t- Electric semi colons.
466
-
467
-Variables specific to this mode:
468
-
469
-  graphviz-dot-dot-program            (default `dot')
470
-       Location of the dot program.
471
-  graphviz-dot-view-command           (default `doted %s')
472
-       Command to run when `graphviz-dot-view' is executed.
473
-  graphviz-dot-view-edit-command      (default nil)
474
-       If the user should be asked to edit the view command.
475
-  graphviz-dot-save-before-view       (default t)
476
-       Automatically save current buffer berore `graphviz-dot-view'.
477
-  graphviz-dot-preview-extension      (default `png')
478
-       File type to use for `graphviz-dot-preview'.
479
-  graphviz-dot-auto-indent-on-newline (default t)
480
-       Whether to run `electric-graphviz-dot-terminate-line' when 
481
-       newline is entered.
482
-  graphviz-dot-auto-indent-on-braces (default t)
483
-       Whether to run `electric-graphviz-dot-open-brace' and
484
-       `electric-graphviz-dot-close-brace' when braces are 
485
-       entered.
486
-  graphviz-dot-auto-indent-on-semi (default t)
487
-       Whether to run `electric-graphviz-dot-semi' when semi colon
488
-       is typed.
489
-  graphviz-dot-toggle-completions  (default nil)
490
-       If completions should be displayed in the buffer instead of a
491
-       completion buffer when \\[graphviz-dot-complete-word] is
492
-       pressed repeatedly.
493
-
494
-This mode can be customized by running \\[graphviz-dot-customize].
495
-
496
-Turning on Graphviz Dot mode calls the value of the variable 
497
-`graphviz-dot-mode-hook' with no args, if that value is non-nil."
498
-  (interactive)
499
-  (kill-all-local-variables)
500
-  (use-local-map graphviz-dot-mode-map)
501
-  (setq major-mode 'graphviz-dot-mode)
502
-  (setq mode-name "dot")
503
-  (setq local-abbrev-table graphviz-dot-mode-abbrev-table)
504
-  (set-syntax-table graphviz-dot-mode-syntax-table)
505
-  (set (make-local-variable 'indent-line-function) 'graphviz-dot-indent-line)
506
-  (set (make-local-variable 'comment-start) "//")
507
-  (set (make-local-variable 'comment-start-skip) "/\\*+ *\\|//+ *")
508
-  (set (make-local-variable 'font-lock-defaults) 
509
-       '(graphviz-dot-font-lock-keywords))
510
-  ;; RR - If user is running this in the scratch buffer, there is no
511
-  ;; buffer file name...
512
-  (if (buffer-file-name)
513
-      (set (make-local-variable 'compile-command) 
514
-       (concat graphviz-dot-dot-program
515
-               " -T" graphviz-dot-preview-extension " "
516
-               buffer-file-name
517
-               " > "
518
-               (file-name-sans-extension
519
-                buffer-file-name)
520
-               "." graphviz-dot-preview-extension)))
521
-  (set (make-local-variable 'compilation-parse-errors-function)
522
-       'graphviz-dot-compilation-parse-errors)
523
-  (if dot-menu
524
-      (easy-menu-add dot-menu))
525
-  (run-hooks 'graphviz-dot-mode-hook)
526
-  )
527
-
528
-;;;; Menu definitions
529
-
530
-(defvar dot-menu nil
531
-  "Menu for Graphviz Dot Mode.
532
-This menu will get created automatically if you have the `easymenu'
533
-package. Note that the latest X/Emacs releases contain this package.")
534
-
535
-(and (condition-case nil
536
-         (require 'easymenu)
537
-       (error nil))
538
-     (easy-menu-define
539
-      dot-menu graphviz-dot-mode-map "Graphviz Mode menu"
540
-      '("Graphviz"
541
-        ["Indent Graph"       graphviz-dot-indent-graph     t]
542
-        ["Comment Out Region" comment-region                (mark)]
543
-        ["Uncomment Region"   graphviz-dot-uncomment-region (mark)]
544
-        "-"
545
-        ["Compile"            compile                       t]
546
-        ["Preview"            graphviz-dot-preview        
547
-         (and (buffer-file-name)
548
-              (not (buffer-modified-p)))]
549
-        ["External Viewer"    graphviz-dot-view             (buffer-file-name)]
550
-        "-"
551
-        ["Customize..."       graphviz-dot-customize        t]
552
-        )))
553
-
554
-;;;; Compilation
555
-
556
-;; note on graphviz-dot-compilation-parse-errors:
557
-;;  It would nicer if we could just use compilation-error-regexp-alist
558
-;;  to do that, 3 options:
559
-;;   - still write dot-compilation-parse-errors, don't build
560
-;;     a return list, but modify the *compilation* buffer
561
-;;     in a way compilation-error-regexp-alist recognizes the
562
-;;     format.
563
-;;     to do that, I should globally change compilation-parse-function
564
-;;     to this function, and call the old value of comp..-parse-fun..
565
-;;     to provide the return value.
566
-;;     two drawbacks are that, every compilation would be run through
567
-;;     this function (performance) and that in autoload there would
568
-;;     be a chance that this function would not yet be known.
569
-;;   - let the compilation run through a filter that would
570
-;;     modify the output of dot or neato:
571
-;;     dot -Tpng input.dot | filter
572
-;;     drawback: ugly, extra work for user, extra decency ...
573
-;;               no-option
574
-;;   - modify dot and neato !!! (PP:15/02/2005 seems to have happend,
575
-;;                                       so version 0.4.0 should clean this mess up!)
576
-(defun graphviz-dot-compilation-parse-errors (limit-search find-at-least)
577
-  "Parse the current buffer for dot errors.
578
-See variable `compilation-parse-errors-functions' for interface."
579
-  (interactive)
580
-  (save-excursion
581
-    (set-buffer "*compilation*")
582
-    (goto-char (point-min))
583
-    (setq compilation-error-list nil)
584
-    (let (buffer-of-error)
585
-      (while (not (eobp))
586
-  (cond
587
-   ((looking-at "^dot\\( -[^ ]+\\)* \\(.*\\)")
588
-    (setq buffer-of-error (find-file-noselect
589
-         (buffer-substring-no-properties
590
-          (nth 4 (match-data t))
591
-          (nth 5 (match-data t))))))
592
-   ((looking-at ".*:.*line \\([0-9]+\\)")
593
-    (let ((line-of-error
594
-     (string-to-number (buffer-substring-no-properties
595
-            (nth 2 (match-data t))
596
-            (nth 3 (match-data t))))))
597
-      (setq compilation-error-list
598
-      (cons
599
-       (cons
600
-        (point-marker)
601
-        (save-excursion
602
-          (set-buffer buffer-of-error)
603
-          (goto-line line-of-error)
604
-          (beginning-of-line)
605
-          (point-marker)))
606
-       compilation-error-list))))
607
-    (t t))
608
-  (forward-line 1)) )))
609
-
610
-;;;;
611
-;;;; Indentation
612
-;;;;
613
-(defun graphviz-dot-uncomment-region (begin end)
614
-	"Uncomments a region of code."
615
-	(interactive "r")
616
-	(comment-region begin end '(4)))
617
-
618
-(defun graphviz-dot-indent-line ()
619
-  "Indent current line of dot code."
620
-  (interactive)
621
-  (if (bolp)
622
-      (graphviz-dot-real-indent-line)
623
-    (save-excursion
624
-      (graphviz-dot-real-indent-line))))
625
-        
626
-(defun graphviz-dot-real-indent-line ()
627
-  "Indent current line of dot code."
628
-  (beginning-of-line)
629
-  (cond
630
-   ((bobp)
631
-    ;; simple case, indent to 0
632
-    (indent-line-to 0))
633
-   ((looking-at "^[ \t]*}[ \t]*$")
634
-    ;; block closing, deindent relative to previous line
635
-    (indent-line-to (save-excursion
636
-                      (forward-line -1)
637
-                      (max 0 (- (current-indentation) graphviz-dot-indent-width)))))
638
-   ;; other cases need to look at previous lines
639
-   (t
640
-    (indent-line-to (save-excursion
641
-                      (forward-line -1)
642
-                      (cond
643
-                       ((looking-at "\\(^.*{[^}]*$\\)")
644
-                        ;; previous line opened a block
645
-                        ;; indent to that line
646
-                        (+ (current-indentation) graphviz-dot-indent-width))
647
-                       ((and (not (looking-at ".*\\[.*\\].*"))
648
-                             (looking-at ".*\\[.*")) ; TODO:PP : can be 1 regex
649
-                        ;; previous line started filling
650
-                        ;; attributes, intend to that start
651
-                        (search-forward "[")
652
-                        (current-column))
653
-                       ((and (not (looking-at ".*\\[.*\\].*"))
654
-                             (looking-at ".*\\].*")) ; TODO:PP : "
655
-                        ;; previous line stopped filling
656
-                        ;; attributes, find the line that started
657
-                        ;; filling them and indent to that line
658
-                        (while (or (looking-at ".*\\[.*\\].*")
659
-                                   (not (looking-at ".*\\[.*"))) ; TODO:PP : "
660
-                          (forward-line -1))
<