From 45875b6f75bc4f8f8d4ed83cd39788c5d18e3318 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Sun, 11 Dec 2005 00:31:46 +0000 Subject: [PATCH] Merged from muse--main--1.0 (patch 278, 281-283) Patches applied: * mwolson@gnu.org--2005/muse--main--1.0--patch-278 Don't split anchors in URLs. * mwolson@gnu.org--2005/muse--main--1.0--patch-281 muse-colors: Add faces for all 3 levels of emphasis. * mwolson@gnu.org--2005/muse--main--1.0--patch-282 muse-mode: Handle case where we visit an anchor-only link. * mwolson@gnu.org--2005/muse--main--1.0--patch-283 muse-mode: Minor fix. git-archimport-id: mwolson@gnu.org--2005/muse--rel--3.02--patch-26 --- AUTHORS | 3 +++ ChangeLog | 32 ++++++++++++++++++++++++++++ ChangeLog.main | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ lisp/muse-colors.el | 27 +++++++++++++++++++++--- lisp/muse-mode.el | 56 ++++++++++++++++++++++++++---------------------- 5 files changed, 151 insertions(+), 28 deletions(-) diff --git a/AUTHORS b/AUTHORS index a974b51..348b6ee 100644 --- a/AUTHORS +++ b/AUTHORS @@ -28,6 +28,9 @@ Peter K. Lee: Contributor, muse-publish.el: 11 lines changed. (assignment pending) +Phillip Lord: Contributor, + muse-colors.el: 3 lines changed. + Jim Ottaway: Contributor, muse-latex.el: 1 line changed. muse-mode.el: 7 lines changed. diff --git a/ChangeLog b/ChangeLog index 55853d5..225cea9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,38 @@ # arch-tag: automatic-ChangeLog--mwolson@gnu.org--2005/muse--rel--3.02 # +2005-12-11 00:31:46 GMT Michael Olson patch-26 + + Summary: + Merged from muse--main--1.0 (patch 278, 281-283) + Revision: + muse--rel--3.02--patch-26 + + Patches applied: + + * mwolson@gnu.org--2005/muse--main--1.0--patch-278 + Don't split anchors in URLs. + + * mwolson@gnu.org--2005/muse--main--1.0--patch-281 + muse-colors: Add faces for all 3 levels of emphasis. + + * mwolson@gnu.org--2005/muse--main--1.0--patch-282 + muse-mode: Handle case where we visit an anchor-only link. + + * mwolson@gnu.org--2005/muse--main--1.0--patch-283 + muse-mode: Minor fix. + + modified files: + AUTHORS ChangeLog ChangeLog.main lisp/muse-colors.el + lisp/muse-mode.el + + new patches: + mwolson@gnu.org--2005/muse--main--1.0--patch-278 + mwolson@gnu.org--2005/muse--main--1.0--patch-281 + mwolson@gnu.org--2005/muse--main--1.0--patch-282 + mwolson@gnu.org--2005/muse--main--1.0--patch-283 + + 2005-12-11 00:22:15 GMT Michael Olson patch-25 Summary: diff --git a/ChangeLog.main b/ChangeLog.main index ea77a3a..269b09f 100644 --- a/ChangeLog.main +++ b/ChangeLog.main @@ -2,6 +2,67 @@ # arch-tag: automatic-ChangeLog--mwolson@gnu.org--2005/muse--main--1.0 # +2005-12-06 16:54:40 GMT Michael Olson patch-283 + + Summary: + muse-mode: Minor fix. + Revision: + muse--main--1.0--patch-283 + + * lisp/muse-mode.el (muse-current-word): Switch order of save-restriction + and save-excursion as recommended by Emacs documentation. + + modified files: + ChangeLog lisp/muse-mode.el + + +2005-12-01 01:32:29 GMT Michael Olson patch-282 + + Summary: + muse-mode: Handle case where we visit an anchor-only link. + Revision: + muse--main--1.0--patch-282 + + * lisp/muse-mode.el (muse-visit-link-default): Handle case where the link + consists of only an anchor. Thanks to Jim Ottaway for the patch. + + modified files: + ChangeLog lisp/muse-mode.el + + +2005-12-01 01:08:13 GMT Michael Olson patch-281 + + Summary: + muse-colors: Add faces for all 3 levels of emphasis. + Revision: + muse--main--1.0--patch-281 + + * lisp/muse-colors.el (muse-emphasis-1, muse-emphasis-2) + (muse-emphasis-3): New faces that represent italic, bold, and bold + italic emphasis, respectively. + (muse-colors-emphasized): Use new faces. Thanks to Phillip Lord for + the suggestion and the initial code. + + modified files: + AUTHORS ChangeLog lisp/muse-colors.el + + +2005-11-21 21:11:14 GMT Michael Olson patch-278 + + Summary: + Don't split anchors in URLs. + Revision: + muse--main--1.0--patch-278 + + * lisp/muse-mode.el (muse-visit-link-default): Install patch from Jim + Ottaway. Remove ANCHOR parameter. Compute the anchor ourselves. Make + sure that we handle URLs before trying to split the anchor. + (muse-visit-link): Don't compute the anchor. Let the callee do that. + + modified files: + ChangeLog lisp/muse-mode.el + + 2005-11-20 22:22:10 GMT Michael Olson patch-276 Summary: diff --git a/lisp/muse-colors.el b/lisp/muse-colors.el index b6208ac..acbac64 100644 --- a/lisp/muse-colors.el +++ b/lisp/muse-colors.el @@ -147,6 +147,27 @@ this to nil." "Face for verbatim text." :group 'muse-colors) +(if (featurep 'xemacs) + (progn + (copy-face 'italic 'muse-emphasis-1) + (copy-face 'bold 'muse-emphasis-2) + (copy-face 'bold-italic 'muse-emphasis-3)) + + (defface muse-emphasis-1 + '((t (:italic t))) + "Face for italic emphasized text." + :group 'muse-colors) + + (defface muse-emphasis-2 + '((t (:bold t))) + "Face for bold emphasized text." + :group 'muse-colors) + + (defface muse-emphasis-3 + '((t (:bold t :italic t))) + "Face for bold italic emphasized text." + :group 'muse-colors)) + (defcustom muse-colors-buffer-hook nil "A hook run after a region is highlighted. Each function receives three arguments: BEG END VERBOSE. @@ -231,9 +252,9 @@ whether progress messages should be displayed to the user." (eq (char-syntax (char-after (1+ b2))) ?w))) (add-text-properties beg e1 '(invisible muse)) (add-text-properties - e1 b2 (list 'face (cond ((= leader 1) 'italic) - ((= leader 2) 'bold) - ((= leader 3) 'bold-italic)))) + e1 b2 (list 'face (cond ((= leader 1) 'muse-emphasis-1) + ((= leader 2) 'muse-emphasis-2) + ((= leader 3) 'muse-emphasis-3)))) (add-text-properties b2 e2 '(invisible muse)) (when multiline (add-text-properties diff --git a/lisp/muse-mode.el b/lisp/muse-mode.el index 6351cc0..ef679a6 100644 --- a/lisp/muse-mode.el +++ b/lisp/muse-mode.el @@ -242,8 +242,8 @@ This is used to keep links from being improperly colorized by flyspell." (defun muse-current-word () (let ((end (point))) - (save-restriction - (save-excursion + (save-excursion + (save-restriction (skip-chars-backward (concat "^\\[" muse-regexp-space)) (narrow-to-region (point) end)) @@ -305,7 +305,7 @@ Do not rename the page originally referred to." t t) (error "There is no valid link at point"))) -(defun muse-visit-link-default (link &optional other-window anchor) +(defun muse-visit-link-default (link &optional other-window) "Visit the URL or link named by LINK. If ANCHOR is specified, search for it after opening LINK. @@ -314,40 +314,46 @@ used by `muse-visit-link' if you have not specified :visit-link in `muse-project-alist'." (if (string-match muse-url-regexp link) (muse-browse-url link) - (let ((base-buffer (get-buffer link))) - (if (and base-buffer (not (buffer-file-name base-buffer))) - ;; If file is temporary (no associated file), just switch to - ;; the buffer - (if other-window - (switch-to-buffer-other-window base-buffer) - (switch-to-buffer base-buffer)) - (let ((project (muse-project-of-file))) - (if project - (muse-project-find-file link project - (and other-window - 'find-file-other-window)) + (let (anchor + base-buffer) + (when (string-match "#" link) + (setq anchor (substring link (match-beginning 0)) + link (if (= (match-beginning 0) 0) + ;; If there is an anchor but no link, default + ;; to the current page. + nil + (substring link 0 (match-beginning 0))))) + (when link + (setq base-buffer (get-buffer link)) + (if (and base-buffer (not (buffer-file-name base-buffer))) + ;; If file is temporary (no associated file), just switch to + ;; the buffer (if other-window - (find-file-other-window link) - (find-file link)))))) - (if anchor + (switch-to-buffer-other-window base-buffer) + (switch-to-buffer base-buffer)) + (let ((project (muse-project-of-file))) + (if project + (muse-project-find-file link project + (and other-window + 'find-file-other-window)) + (if other-window + (find-file-other-window link) + (find-file link)))))) + (when anchor (let ((pos (point))) (goto-char (point-min)) (unless (re-search-forward (concat "^\\W*" (regexp-quote anchor) "\\b") nil t) - (goto-char pos)))))) + (goto-char pos))))))) (defun muse-visit-link (link &optional other-window) "Visit the URL or link named by LINK." (let ((visit-link-function - (muse-get-keyword :visit-link (cadr (muse-project-of-file)) t)) - anchor) + (muse-get-keyword :visit-link (cadr (muse-project-of-file)) t))) (if visit-link-function (funcall visit-link-function link other-window) - (if (string-match "#" link) - (setq anchor (substring link (match-beginning 0)) - link (substring link 0 (match-beginning 0)))) - (muse-visit-link-default link other-window anchor)))) + (muse-visit-link-default link other-window)))) (defun muse-browse-result (style &optional other-window) "Visit the current page's published result." -- 2.11.4.GIT