1 ;;; dgnushack.el --- a hack to set the load path for byte-compiling
2 ;; Copyright (C) 1994-2014 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Keywords: news, path
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 (defvar dgnushack-default-load-path (copy-sequence load-path))
29 (unless (fboundp 'declare-function)
30 (defmacro declare-function (&rest r)))
32 (defalias 'facep 'ignore)
38 (require 'org-entities)
41 (defvar srcdir (or (getenv "srcdir") "."))
42 (defvar loaddir (and load-file-name (file-name-directory load-file-name)))
44 (defun my-getenv (str)
45 (let ((val (getenv str)))
46 (if (equal val "no") nil val)))
48 (if (my-getenv "lispdir")
49 (push (my-getenv "lispdir") load-path))
51 ;(push "/usr/share/emacs/site-lisp" load-path)
53 ;; If we are building Gnus in a different directory than the source
54 ;; directory, we must read *.el from source directory and write *.elc
55 ;; into the building directory. For that, we define this function
56 ;; before loading bytecomp. Bytecomp doesn't overwrite this function.
57 (defun byte-compile-dest-file (filename)
58 "Convert an Emacs Lisp source file name to a compiled file name.
59 In addition, remove directory name part from FILENAME."
60 (setq filename (byte-compiler-base-file-name filename))
61 (setq filename (file-name-sans-versions filename))
62 (setq filename (file-name-nondirectory filename))
63 (if (eq system-type 'windows-nt)
64 (setq filename (downcase filename)))
65 (cond ((eq system-type 'vax-vms)
66 (concat (substring filename 0 (string-match ";" filename)) "c"))
67 ((string-match emacs-lisp-file-regexp filename)
68 (concat (substring filename 0 (match-beginning 0)) ".elc"))
69 (t (concat filename ".elc"))))
72 ;; To avoid having defsubsts and inlines happen.
73 ;(if (featurep 'xemacs)
74 ; (require 'byte-optimize)
75 ; (require 'byte-opt))
76 ;(defun byte-optimize-inline-handler (form)
77 ; "byte-optimize-handler for the `inline' special-form."
78 ; (cons 'progn (cdr form)))
79 ;(defalias 'byte-compile-file-form-defsubst 'byte-compile-file-form-defun)
81 ;; Work around for an incompatibility (XEmacs 21.4 vs. 21.5), see the
84 ;; http://thread.gmane.org/gmane.emacs.gnus.general/56414
85 ;; Subject: attachment problems found but not fixed
87 ;; http://thread.gmane.org/gmane.emacs.gnus.general/56459
88 ;; Subject: Splitting mail -- XEmacs 21.4 vs 21.5
90 ;; http://thread.gmane.org/gmane.emacs.xemacs.beta/20519
91 ;; Subject: XEmacs 21.5 and Gnus fancy splitting.
93 ;; Should be fixed in XEmacs (March 2007).
94 ;; http://thread.gmane.org/gmane.emacs.xemacs.patches/8124
95 ;; When should we remove this workaround?
97 (when (and (featurep 'xemacs)
98 (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
99 (modify-syntax-entry ?= " " table)
101 (with-syntax-table table
103 (goto-char (point-min))
106 ;; The original `with-syntax-table' uses `copy-syntax-table' which
107 ;; doesn't seem to copy modified syntax entries in old XEmacs 21.5.
108 (defmacro with-syntax-table (syntab &rest body)
109 "Evaluate BODY with the SYNTAB as the current syntax table."
110 `(let ((stab (syntax-table)))
113 ;;(set-syntax-table (copy-syntax-table ,syntab))
114 (set-syntax-table ,syntab)
116 (set-syntax-table stab)))))
118 (push srcdir load-path)
119 (push loaddir load-path)
120 (load (expand-file-name "lpath.el" loaddir) nil t)