Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Version 1.68

  • Loading branch information...
commit 1f6f76b979258b70a9a1aa0133490b56fb47b885 1 parent 4a9b262
@lborgman lborgman authored
View
69 autostart22.el
@@ -0,0 +1,69 @@
+;;; autostart22.el --- Example of autostart file for Emacs22
+;;
+;; Author: Lennart Borgman (lennart O borgman A gmail O com)
+;; Created: 2009-01-01 Thu
+;; Version:
+;; Last-Updated:
+;; URL:
+;; Keywords:
+;; Compatibility:
+;;
+;; Features that might be required by this library:
+;;
+;; None
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+;;
+;; Change this file according to the path of your nxml-mode dir. If
+;; you do not use nxml-mode then just use autostart.el.
+;;
+;; NOTICE: You need to enter the path to your nxml-mode installation
+;; below.
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Change log:
+;;
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or
+;; (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING. If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+;; Floor, Boston, MA 02110-1301, USA.
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Code:
+
+(let ((debug-on-error t))
+ (unless (= emacs-major-version 22)
+ (error "This file is for Emacs 22 only"))
+
+ (defalias 'Custom-mode 'custom-mode)
+
+ (let* ((this-file (or load-file-name buffer-file-name))
+ (this-dir (file-name-directory this-file))
+ ;; FIX-ME: PLACE THE PATH TO YOUR nXml HERE:
+ (rng-auto-file "c:/emacs/u/081231/EmacsW32/nxhtml/nxml-mode-20041004/rng-auto.el"))
+ (unless (file-exists-p rng-auto-file)
+ (error "Can't find rng-auto.el, please edit %s" this-file))
+ (load rng-auto-file)
+ ;;(load-file (expand-file-name "autostart.el" this-dir))
+ ))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; autostart22.el ends here
View
1  emacs22.cmd
@@ -0,0 +1 @@
+c:\emacs\emacs-22.3\bin\emacs.exe -Q --debug-init -l autostart.el
View
BIN  etc/img/pause/pause.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  etc/img/pause/pause2.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2,836 nxhtml/nxhtml-mode.el
2,836 additions, 0 deletions not shown
View
317 nxhtmlmaint.el
@@ -0,0 +1,317 @@
+;;; nxhtmlmaint.el --- Some maintenance helpers
+;;
+;; Author: Lennart Borgman (lennart O borgman A gmail O com)
+;; Created: 2008-09-27T15:29:35+0200 Sat
+;; Version: 0.5
+;; Last-Updated: 2009-12-30 Tue
+;; URL:
+;; Keywords:
+;; Compatibility:
+;;
+;; Features that might be required by this library:
+;;
+;; Cannot open load file: nxhtmlmaint.
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+;;
+;; This module contains maintenance functions:
+;;
+;; `nxhtmlmaint-get-all-autoloads'
+;; `nxhtmlmaint-start-byte-compilation'
+;; `nxhtmlmaint-byte-uncompile-all'
+;;
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Change log:
+;;
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or
+;; (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING. If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+;; Floor, Boston, MA 02110-1301, USA.
+;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Code:
+
+;;(eval-when-compile (require 'ourcomments-util))
+
+(defvar nxhtmlmaint-dir
+ (file-name-directory (if load-file-name load-file-name buffer-file-name))
+ "Maintenance directory for nXhtml.")
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;; Autoload helpers
+
+(defun nxhtmlmaint-autoloads-file ()
+ "Return autoload file name for nXhtml."
+ (file-truename (expand-file-name "nxhtml-loaddefs.el" nxhtmlmaint-dir)))
+
+(defun nxhtmlmaint-util-dir ()
+ "Return nXhtml util directory."
+ (file-truename (file-name-as-directory
+ (expand-file-name "util" nxhtmlmaint-dir))))
+
+(defvar nxhtmlmaint-autoload-default-directory (nxhtmlmaint-util-dir))
+
+(defvar generated-autoload-file)
+
+(defun nxhtmlmaint-initialize-autoloads-file ()
+ "Initialize nXhtml autoload file."
+ (with-current-buffer (find-file-noselect generated-autoload-file)
+ (when (= 0 (buffer-size))
+ (insert ";; Autoloads for nXthml
+;;
+;; This file should be updated by `nxhtmlmaint-get-file-autoloads',
+;; `nxhtmlmaint-get-dir-autoloads' or `nxhtmlmaint-get-all-autoloads'.")
+ (basic-save-buffer))))
+
+(defun nxmtmlmaint-advice-autoload (on)
+ "Activate advices if ON, otherwise turn them off."
+ (if on
+ (progn
+ (ad-activate 'autoload-file-load-name)
+ (ad-activate 'make-autoload))
+ (ad-deactivate 'autoload-file-load-name)
+ (ad-deactivate 'make-autoload)))
+
+(defun nxhtmlmaint-get-file-autoloads (file)
+ "Get autoloads for file FILE.
+Update nXhtml autoload file with them."
+ (interactive (list (buffer-file-name)))
+ (let* ((generated-autoload-file (nxhtmlmaint-autoloads-file))
+ (emacs-lisp-mode-hook nil)
+ (default-directory (nxhtmlmaint-util-dir)))
+ (nxhtmlmaint-initialize-autoloads-file)
+ ;; Get the autoloads using advice
+ (nxmtmlmaint-advice-autoload t)
+ (update-file-autoloads file nil)
+ (nxmtmlmaint-advice-autoload nil)
+ ;; Display
+ (display-buffer (find-file-noselect generated-autoload-file))))
+
+(defun nxhtmlmaint-get-dir-autoloads (dir)
+ "Get autoloads for directory DIR.
+Update nXhtml autoload file with them."
+ (interactive (list (or (when (buffer-file-name)
+ (file-name-directory (buffer-file-name)))
+ default-directory)))
+ (let* ((generated-autoload-file (nxhtmlmaint-autoloads-file))
+ (emacs-lisp-mode-hook nil)
+ (auto-buf (find-file-noselect generated-autoload-file)))
+ (nxhtmlmaint-initialize-autoloads-file)
+ ;; Get the autoloads using advice
+ (nxmtmlmaint-advice-autoload t)
+ ;; Fix-me: Loop instead, some files must be avoided.
+ (update-directory-autoloads dir)
+ (nxmtmlmaint-advice-autoload nil)
+ ;; Display
+ (display-buffer (find-file-noselect generated-autoload-file))))
+
+(defun nxhtmlmaint-get-tree-autoloads (root)
+ "Get autoloads for directory tree ROOT.
+Update nXhtml autoload file with them."
+ (interactive (list (or (when (buffer-file-name)
+ (file-name-directory (buffer-file-name)))
+ default-directory)))
+ (message "Getting autoloads in %s" root)
+ (nxhtmlmaint-get-dir-autoloads root)
+ (let* ((files (directory-files root))
+ (sub-dirs (mapcar (lambda (file)
+ (when (and (not (member file '("." "..")))
+ (not (member file '("nxml-mode-20041004" "old")))
+ (not (member file '("in")))
+ (file-directory-p (expand-file-name file root)))
+ file))
+ files)))
+ (setq sub-dirs (delq nil sub-dirs))
+ ;;(message "sub-dirs=%s" sub-dirs)
+ (dolist (dir sub-dirs)
+ (let ((full-dir (expand-file-name dir root)))
+ (unless (or (string= full-dir nxhtmlmaint-dir)
+ (string= dir "alts"))
+ (nxhtmlmaint-get-tree-autoloads full-dir))))))
+
+(defun nxhtmlmaint-get-all-autoloads ()
+ "Get all autoloads for nXhtml.
+Update nXhtml autoload file with them."
+ (interactive)
+ (let ((auto-buf (find-file-noselect (nxhtmlmaint-autoloads-file))))
+ (with-current-buffer auto-buf
+ (erase-buffer)
+ (basic-save-buffer))
+ (nxhtmlmaint-get-tree-autoloads nxhtmlmaint-dir)
+ ;; `nxhtml-mode' and `nxhtml-validation-header-mode' should only be
+ ;; autoloaded if nxml-mode if available.
+ (with-current-buffer auto-buf
+ (message "Fixing nxml autoloads")
+ (let ((frmt (if (= emacs-major-version 22)
+ "^(autoload (quote %s) "
+ "^(autoload '%s ")))
+ (dolist (nxmode '(nxhtml-mode nxhtml-validation-header-mode))
+ (goto-char (point-min))
+ (when (re-search-forward (format frmt nxmode) nil t)
+ (forward-line 0)
+ (insert "(when (fboundp 'nxml-mode)\n")
+ (forward-sexp)
+ (insert ")"))))
+ (basic-save-buffer))))
+
+
+(defun nxhtmlmaint-autoload-file-load-name (file)
+ "Return relative file name for FILE to autoload file directory."
+ (let ((name (if nxhtmlmaint-autoload-default-directory
+ (file-relative-name
+ file nxhtmlmaint-autoload-default-directory)
+ (file-name-nondirectory file))))
+ (if (string-match "\\.elc?\\(\\.\\|\\'\\)" name)
+ (substring name 0 (match-beginning 0))
+ name)))
+
+(defadvice autoload-file-load-name (around
+ nxhtmlmaint-advice-autoload-file-load-name
+ ;;activate
+ compile)
+ "Advice to return relative file name."
+ (setq ad-return-value (nxhtmlmaint-autoload-file-load-name (ad-get-arg 0))))
+
+(defun nxhtmlmaint-make-autoload (form file)
+ "Make autoload for multi major modes."
+ ;;(message "form=%S" form)
+ (if (or (not (listp form))
+ (not (eq 'define-mumamo-multi-major-mode (car form))))
+ ad-return-value
+ (if ad-return-value
+ ad-return-value
+ ;; Fix-me: Maybe expand??
+ (let ((name (nth 1 form))
+ (doc (nth 2 form)))
+ `(autoload ',name ,file ,doc t)
+ ))))
+
+(defadvice make-autoload (after
+ nxhtmlmaint-advice-make-autoload
+ ;;activate
+ compile)
+ "Make autoload for multi major modes."
+ (setq ad-return-value
+ (nxhtmlmaint-make-autoload (ad-get-arg 0)
+ (ad-get-arg 1))))
+
+;; (defun nxhtmlmaint-generate-library-autoloads (library)
+;; "Insert at point autoloads for Emacs library LIBRARY.
+;; Works like `generate-file-autoloads', but for a library."
+;; (interactive
+;; (list (completing-read "Generate autoloads for library: "
+;; 'locate-file-completion
+;; (cons load-path (get-load-suffixes)))))
+;; (let ((file (locate-library library)))
+;; ;; Fix-me: wasn't this defined???
+;; (generate-file-autoloads file)))
+
+;;;###autoload
+(defun nxhtmlmaint-start-byte-compilation ()
+ "Start byte compilation of nXhtml in new Emacs instance.
+Byte compiling in general makes elisp code run 5-10 times faster
+which is quite noticeable when you use nXhtml.
+
+You must restart Emacs to use the byte compiled files.
+
+If for some reason the byte compiled files does not work you can
+remove then with `nxhtmlmaint-byte-uncompile-all'."
+ (interactive)
+ (let ((this-file (expand-file-name "nxhtmlmaint.el" nxhtmlmaint-dir))
+ (auto-file (expand-file-name "autostart.el" nxhtmlmaint-dir)))
+ ;;(message "this-file=%s" this-file)
+ (nxhtmlmaint-byte-uncompile-all)
+ (nxhtmlmaint-get-all-autoloads)
+ (require 'ourcomments-util)
+ (call-process (ourcomments-find-emacs) nil 0 nil "-Q"
+ "-l" this-file
+ "-l" auto-file
+ "-f" "nxhtmlmaint-byte-compile-all"))
+ (message "Starting new Emacs instance for byte compiling ..."))
+
+;;(nxhtmlmaint-byte-compile-all)
+(defun nxhtmlmaint-byte-compile-all ()
+ "Byte recompile all files in nXhtml that needs it."
+ (let* ((load-path load-path)
+ (nxhtml-dir (file-name-as-directory
+ (expand-file-name "nxhtml"
+ nxhtmlmaint-dir)))
+ (util-dir (file-name-as-directory
+ (expand-file-name "util"
+ nxhtmlmaint-dir)))
+ (related-dir (file-name-as-directory
+ (expand-file-name "related"
+ nxhtmlmaint-dir)))
+ (tests-dir (file-name-as-directory
+ (expand-file-name "tests"
+ nxhtmlmaint-dir)))
+ )
+ (add-to-list 'load-path nxhtml-dir)
+ (add-to-list 'load-path util-dir)
+ (add-to-list 'load-path related-dir)
+ (add-to-list 'load-path tests-dir)
+ (require 'cl) ;; This is run in a new Emacs
+ (let ((dummy-debug-on-error t))
+ (nxhtmlmaint-byte-compile-dir nxhtmlmaint-dir nil nil))
+ (message "Byte compiling is ready, restart Emacs to use the compiled files")))
+
+;;(nxhtmlmaint-byte-uncompile-all)
+(defun nxhtmlmaint-byte-uncompile-all ()
+ "Delete byte compiled files in nXhtml."
+ (interactive)
+ (let ((dummy-debug-on-error t))
+ (nxhtmlmaint-byte-compile-dir nxhtmlmaint-dir t t))
+ (message "Byte uncompiling is ready, restart Emacs to use the elisp files"))
+
+(defconst nxhtmlmaint-nonbyte-compile-dirs '("." ".." "alts" "nxml-mode-20041004" "old" "xtests"))
+
+(defun nxhtmlmaint-byte-compile-dir (dir force del-elc)
+ "Byte compile or uncompile directory tree DIR.
+If FORCE is non-nil byte recompile the elisp file even if the
+compiled file is newer.
+
+If DEL-ELC is nil then byte compile files. If DEL-ELC is non-nil
+then instead delete the compiled files."
+ ;;(directory-files (file-name-directory buffer-file-name) t "\.el\\'")
+ (dolist (el-src (directory-files dir t "\.el\\'"))
+ (let ((elc-dst (concat el-src "c")))
+ (if del-elc
+ (when (file-exists-p elc-dst)
+ (delete-file elc-dst)
+ (message "Deleted %s" elc-dst))
+ (setq debug-on-error t)
+ (when (or force (file-newer-than-file-p el-src elc-dst))
+ ;;(message "fn=%s" (file-name-nondirectory el-src))
+ (when t ;;(string= "nxhtml-menu.el" (file-name-nondirectory el-src))
+ (message "(byte-compile-file %s)" el-src)
+ (unless (byte-compile-file el-src)
+ (message "Couldn't compile %s" el-src))
+ )
+ ))))
+ (dolist (f (directory-files dir t))
+ (when (file-directory-p f)
+ ;; Fix-me: Avoid some dirs
+ (let ((name (file-name-nondirectory f)))
+ (unless (member name nxhtmlmaint-nonbyte-compile-dirs)
+ (nxhtmlmaint-byte-compile-dir f force del-elc))))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; nxhtmlmaint.el ends here
Please sign in to comment.
Something went wrong with that request. Please try again.