run-mode-hooks undefined Windows, possible workaround

Gleb Arshinov gleb-xemacs at barsook.com
Thu Oct 6 17:05:51 EDT 2005


Current Windows native build, as distributed through www.xemacs.org
breaks when used with current packages.  This has been discussed
before.  Adding relevant functions from later XEmacs version to .emacs
seems to fix the problem.  How about adding this to the FAQ?

Thanks,

Gleb


;; BEGIN FSF 21.3 SYNCH 
(defmacro with-local-quit (&rest body) 
  "Execute BODY with `inhibit-quit' temporarily bound to nil." 
  `(condition-case nil 
    (let ((inhibit-quit nil)) 
      , at body) 
    (quit (setq quit-flag t)))) 
 
(defvar delay-mode-hooks nil 
  "If non-nil, `run-mode-hooks' should delay running the hooks.") 
(defvar delayed-mode-hooks nil 
  "List of delayed mode hooks waiting to be run.") 
(make-variable-buffer-local 'delayed-mode-hooks) 
(put 'delay-mode-hooks 'permanent-local t) 
 
(defun run-mode-hooks (&rest hooks) 
  "Run mode hooks `delayed-mode-hooks' and HOOKS, or delay HOOKS. 
Execution is delayed if `delay-mode-hooks' is non-nil. 
Major mode functions should use this." 
  (if delay-mode-hooks 
      ;; Delaying case. 
      (dolist (hook hooks) 
        (push hook delayed-mode-hooks)) 
    ;; Normal case, just run the hook as before plus any delayed hooks. 
    (setq hooks (nconc (nreverse delayed-mode-hooks) hooks)) 
    (setq delayed-mode-hooks nil) 
    (apply 'run-hooks hooks))) 
 
(defmacro delay-mode-hooks (&rest body) 
  "Execute BODY, but delay any `run-mode-hooks'. 
Only affects hooks run in the current buffer." 
  `(progn 
    (make-local-variable 'delay-mode-hooks) 
    (let ((delay-mode-hooks t)) 
      , at body))) 
;; END FSF 21.3 SYNCH 




More information about the XEmacs-Beta mailing list