From 78e7471c9ebef236e062d5de8bc6f8b503f6784d Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Mon, 30 Oct 2006 04:50:57 +0000 Subject: [PATCH] Fix bug #7424: Error in redisplay while using Emacs 21.3 2006-10-29 Michael Olson * lisp/muse-wiki.el (muse-wiki-update-project-file-regexp) (muse-wiki-update-interwiki-regexp): Ensure that nil is never passed to regexp-opt, since that can cause Emacs 21 to throw an "maximum binding depth exceeded" error. Thanks to xs32 AT cornell DOT edu for the report. (muse-wiki-handle-wikiword): Avoid a potential stringp error. git-archimport-id: mwolson@gnu.org--2006/muse--main--1.0--patch-235 --- ChangeLog | 6 ++++++ lisp/muse-wiki.el | 42 ++++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe11626..f970ef1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,12 @@ of the current page as the local path, instead of duplicating the remote file's path. This probably fixes at least one reported bug. since it's quite major. + (muse-wiki-update-project-file-regexp) + (muse-wiki-update-interwiki-regexp): Ensure that nil is never + passed to regexp-opt, since that can cause Emacs 21 to throw an + "maximum binding depth exceeded" error. Thanks to xs32 AT cornell + DOT edu for the report. + (muse-wiki-handle-wikiword): Avoid a potential stringp error. 2006-10-28 Michael Olson diff --git a/lisp/muse-wiki.el b/lisp/muse-wiki.el index 468fd4f..71590e3 100644 --- a/lisp/muse-wiki.el +++ b/lisp/muse-wiki.el @@ -75,13 +75,13 @@ when `muse-wiki-martch-all-project-files' is non-nil.") all the files in the project." ;; see if the user wants to match project files (when muse-wiki-match-all-project-files - (setq muse-wiki-project-file-regexp - (concat "\\(" - ;; include all files from the project - (regexp-opt (mapcar 'car - (muse-project-file-alist (muse-project))) - 'words) - "\\)")) + (let ((files (mapcar #'car (muse-project-file-alist (muse-project))))) + (setq muse-wiki-project-file-regexp + (when files + (concat "\\(" + ;; include all files from the project + (regexp-opt files 'words) + "\\)")))) ;; update coloring setup (when (featurep 'muse-colors) (muse-configure-highlighting @@ -157,25 +157,26 @@ If you want this replacement to happen, you must add (defun muse-wiki-update-interwiki-regexp () "Update the value of `muse-wiki-interwiki-regexp' based on `muse-wiki-interwiki-alist' and `muse-project-alist'." + (muse-assert (consp muse-project-alist)) (setq muse-wiki-interwiki-regexp - (concat "\\<\\(" (regexp-opt (mapcar 'car muse-project-alist)) + (concat "\\<\\(" (regexp-opt (mapcar #'car muse-project-alist)) (when muse-wiki-interwiki-alist - (concat "\\|" - (regexp-opt (mapcar 'car - muse-wiki-interwiki-alist)))) + (let ((interwiki-rules (mapcar #'car + muse-wiki-interwiki-alist))) + (when interwiki-rules + (concat "\\|" (regexp-opt interwiki-rules))))) "\\)\\(?:\\(?:" muse-wiki-interwiki-delimiter "\\)\\(" (when muse-wiki-match-all-project-files ;; append the files from the project - (concat - (let ((files nil)) - (dolist (proj muse-project-alist) - (setq files - (nconc (muse-wiki-project-files-with-spaces - (car proj)) - files))) - (regexp-opt files)) - "\\|")) + (let ((files nil)) + (dolist (proj muse-project-alist) + (setq files + (nconc (muse-wiki-project-files-with-spaces + (car proj)) + files))) + (when files + (concat (regexp-opt files) "\\|")))) "\\sw+\\)\\)?\\>")) (when (featurep 'muse-colors) (muse-configure-highlighting 'muse-colors-markup muse-colors-markup))) @@ -282,6 +283,7 @@ Match 2 is set to the description." Match 1 is set to the WikiWord." (when (and (or (and muse-wiki-match-all-project-files + muse-wiki-project-file-regexp (if string (string-match muse-wiki-project-file-regexp string) (looking-at muse-wiki-project-file-regexp))) -- 2.11.4.GIT