]> code.delx.au - gnu-emacs-elpa/blob - packages/notes-mode/notes-variables.el
Merge commit '67fa7e1a60966e49eccf21b02110af12afa995e0'
[gnu-emacs-elpa] / packages / notes-mode / notes-variables.el
1 ;;; notes-variables.el --- Configuration variables for notes-mode
2
3 ;; Copyright (C) 1994-2000,2012 Free Software Foundation, Inc.
4
5 ;; Author: <johnh@isi.edu>
6
7 ;; This file is part of GNU Emacs.
8
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
13
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22 ;;; Commentary:
23
24 ;;
25 ;; This file lists all parameters you might wish to change in
26 ;; notes{-index,}-mode. The best way to handle this in your
27 ;; .emacs file is to do
28 ;; (require 'notes-variables)
29 ;; (setq your-variable-to-change 'your-new value)
30 ;;
31
32 ;;; Code:
33
34 ;; xxx: if part of emacs, this should be probably be set to exec-directory (?)
35 (defconst notes-utility-dir (file-name-directory load-file-name)
36 "Location of notes utility programs.")
37
38 ;;
39 ;; Notice: several notes parameters are defined in your
40 ;; ~/.notesrc file. These are not specified here.
41 ;; See mkconfig for details.
42 ;; We fetch them here.
43 ;;
44 ;; To make this fast, we cache the configuration in a .notesrc.el
45 ;; file. We only have to invoke mkconfig when that file is out-of-date.
46 ;; This optimization is very important because notes-variables is
47 ;; required every time emacs is started.
48 ;;
49 (save-current-buffer
50 (if (null (file-exists-p (expand-file-name "mkconfig" notes-utility-dir)))
51 (error "Notes-mode is incorrectly installed."))
52 (let*
53 ((source-file (expand-file-name "~/.notesrc"))
54 (cache-file (expand-file-name "~/.notesrc.el")))
55 (if (and
56 (not (file-exists-p source-file))
57 (not noninteractive))
58 (progn
59 (require 'notes-first)
60 (notes-first-use-init)))
61 (with-temp-buffer
62 (if (and ;; Requirements for a valid cache-file.
63 (file-exists-p cache-file)
64 (if (file-exists-p source-file)
65 (file-newer-than-file-p cache-file source-file)
66 t)
67 (file-newer-than-file-p
68 cache-file (expand-file-name "mkconfig" notes-utility-dir)))
69 (insert-file-contents cache-file) ;; Cache is up-to-date.
70 ;; Otherwise, refresh the cache.
71 (call-process (expand-file-name "mkconfig" notes-utility-dir)
72 nil t nil "elisp")
73 (write-region (point-min) (point-max) cache-file)
74 (set-file-modes cache-file #o644)) ;; Protect it => mode 0644.
75 (eval-buffer))))
76
77 ;; notes-int-glob and notes-file-glob should have been set in ~/.notesrc.el.
78 (add-to-list 'auto-mode-alist
79 (cons
80 ;; FIXME: auto-mode-alist actually takes a regexp, not a glob.
81 ;; The default globs happen to fall within the intersection of
82 ;; regexps and globs, but we shouldn't rely on it!
83 (concat notes-int-glob "/" notes-file-glob ".?\\'")
84 'notes-mode))
85
86 ;;; xxx: most of these should use defcustom or something similar, I presume.
87 (defvar notes-w3-alternate-url 'browse-url
88 "* A function to call when notes-w3-url cannot handle a complex URL.
89 It now goes through the Emacs `browse-url' package,
90 but you could also set it manually (say, to w3-fetch).")
91
92 (defvar notes-use-font-lock t
93 "* Enable notes fontification.")
94
95 (defvar notes-use-outline-mode t
96 "* Enable `outline-minor-mode' in all notes buffers?")
97
98 (defvar notes-index-fontify-dates nil
99 "* Fontify dates in notes-index-mode.
100 Turning this off for large notes-index's can improve performance.")
101
102 (defvar notes-bold-face 'notes-bold-face
103 "* Face to use for notes-index-mode and notes-mode subjects.
104 The default face is copied from 'bold.")
105
106 (defvar notes-font-lock-keywords
107 '(("^\\* .*$" . notes-bold-face)
108 ("^\\-+$" . notes-bold-face)
109 ;; ("^[0-9]+\\-[A-Za-z]+\\-[0-9]+ [A-Za-z]+$" . font-lock-bold-face)
110 ;; NEEDSWORK: should also highlight URLs, maybe?
111 )
112 "* Font-lock keywords for notes mode.")
113
114 (defvar notes-index-font-lock-keywords
115 '(("^[^:]*:" . notes-bold-face)
116 ("\\<[0-9]*\\>" . mouse-face)
117 )
118 "* Font-lock keywords for notes-index mode.")
119
120 (defvar notes-mode-complete-subjects t
121 "* Enable subject completion in notes mode?")
122
123 (defvar notes-w3-follow-link-mouse-other-window t
124 "* Should notes-w3-follow-link-mouse open another window?")
125
126 (defvar notes-subject-table nil
127 "List of notes-subjects needed for subject completion.
128 Reloaded by loading the notes-index file.")
129
130 (defvar notes-mode-initialization-program "mknew"
131 "Program to run to initialize a new notes file. Must be in notes-bin-dir.
132 If nil, no initialization is done.")
133
134 (defvar notes-encryption-key-id nil
135 "Keyid of PGP key for the current user.
136 Useful if your \\[user-full-name] doesn't match a unique key.
137 Should have a leading 0x.")
138
139 (defvar notes-electric-prevnext 2
140 "Amount of electricity in prevnext for notes-mode.
141 nil: don't auto-update anything.
142 1: update prevnext, but don't autosave the old buffer
143 2: update prevnext and autosave the old buffer.")
144
145 (if (featurep 'xemacs)
146 (require 'notes-xemacs)
147 (require 'notes-emacs))
148
149 (defvar notes-platform-inited nil
150 "Have we inited our platform (XEmacs/Emacs)?")
151
152 (run-hooks 'notes-variables-load-hooks)
153 (provide 'notes-variables)
154 ;;; notes-variables.el ends here