1 ;;; nxhtml-base.el --- The very, very basic vars...
3 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
4 ;; Created: 2010-01-13 Wed
11 ;; Features that might be required by this library:
15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19 ;; Things that always must be loaded and that are often necessary when
22 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29 ;; This program is free software; you can redistribute it and/or
30 ;; modify it under the terms of the GNU General Public License as
31 ;; published by the Free Software Foundation; either version 3, or
32 ;; (at your option) any later version.
34 ;; This program is distributed in the hope that it will be useful,
35 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
36 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37 ;; General Public License for more details.
39 ;; You should have received a copy of the GNU General Public License
40 ;; along with this program; see the file COPYING. If not, write to
41 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
42 ;; Floor, Boston, MA 02110-1301, USA.
44 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
48 ;;(eval-when-compile (require 'web-vcs nil t))
49 (eval-when-compile (require 'flymake-js nil t))
50 (eval-when-compile (require 'flymake-css nil t))
51 (eval-when-compile (require 'flymake-java-1 nil t))
53 (defconst nxhtml-menu:version "2.08")
54 (setq message-log-max t)
55 (setq debug-on-error t)
57 (defconst nxhtml-install-dir
58 (file-name-directory (or load-file-name
59 (when (boundp 'bytecomp-filename) bytecomp-filename)
61 "Installation directory for nXhtml.")
63 (define-minor-mode nxhtml-autoload-web
64 "If on download elisp files from web when they are needed.
65 If t then during `require' nXhtml elisp files can be downloaded
66 from the nXhtml repository on the web. This will currently
67 download the development sources, latest version.
69 Other files that are used by a command may also be downloaded.
71 Note that files are not updated automatically. You have to use
72 `nxhtml-update-existing-files' for that."
74 ;;:lighter (propertize " nX" 'face 'font-lock-comment-face)
78 (defun nxhtml-autoload (fun src &optional docstring interactive type)
79 "Generalized `autoload'. May setup autoload from the web.
80 If `nxhtml-autoload-web' is t then setup autoloading from the web.
81 Otherwise setup for normal local autoloading."
82 (if nxhtml-autoload-web
84 ;; Do not require this until we really need it.
85 (require 'web-autoload)
86 (web-autoload fun src docstring interactive type))
89 (setq file (file-name-nondirectory (nth 2 file))))
90 (autoload fun file docstring interactive type))))
92 ;; Fix-me: web autoload defcustoms.
94 ;; I have no good idea how to fix this. It looks like I have to
95 ;; defadvice `custom-load-symbol'. I thought that should not be
96 ;; necessary since it does (require load) on line 605 but the web
97 ;; autoload does not start. Why? Hm, you never know since it is inside
98 ;; a (condition-case nil ...).
100 ;; Ah, found it. The require is only done if custom loads contains a
101 ;; symbol, not a string. So I changed this to a symbol instead in
102 ;; nxhtml-loaddefs.el. Maybe `load' instead of `require' should be
105 ;; What a hell is this below? Have things been rewritten in custom or
106 ;; did I mix somethintg?
107 (defun nxhtml-custom-autoload (symbol load &optional noset)
108 "Like `custom-autoload', but also run :set for defcustoms etc."
109 ;; Fix-me: is-boundp is currently always t because of the order in
110 ;; loaddefs. Hm, so this worked just by chance...
111 (let* ((is-boundp (prog1 (boundp symbol)
112 (custom-autoload symbol load noset)))
113 (standard (get symbol 'standard-value))
114 (saved (get symbol 'saved-value))
115 ;; Fix-me: property custom-set etc are not available
116 (custom-set (get symbol 'custom-set))
117 (custom-initialize (get symbol 'custom-initialize))
118 (set (or custom-set 'custom-set-default))) ;; Fix-me: initialize
119 (setq custom-set t) ;; Not available here
120 (when (or custom-initialize
122 (not (equal (car saved) (symbol-value symbol)))
124 (funcall set symbol (car saved))
125 (custom-load-symbol symbol))))
127 (defun flymake-init-load-flymakemsg ()
128 (require 'flymakemsg))
130 (define-minor-mode nxhtml-flymake-setup
131 "Let nXhtml add some addtions to flymake.
132 This adds support for CSS and JavaScript files.
134 It also adds showing of errors in minibuffer when point is on
137 If you turn this off you must restart Emacs for it to take
141 (when nxhtml-flymake-setup
144 (flymake-java-1-load)
145 (add-hook 'flymake-mode-hook 'flymake-init-load-flymakemsg)))
148 (provide 'nxhtml-base)
149 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
150 ;;; nxhtml-base.el ends here