From 8d21c1ebd69ab07d288fa61c77177eef15ca3632 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Tue, 4 Jul 2006 05:00:35 +0000 Subject: [PATCH] Fix publishing bug introduced in last patch. * lisp/muse-project.el (muse-current-output-style): New variable that holds the output style that is currently being used to publish a file. (muse-project-page-file): When a subdirectory is used, only record matches. Sort using matches, not entire list. (muse-project-resolve-link): Docfix. (muse-project-current-output-style): New function that returns the current output style. (muse-project-link-page): Use the local output style, not the other kind of style. (muse-project-publish-file): Set muse-current-output-style. * lisp/muse-wiki.el (muse-wiki-resolve-project-page): Use muse-current-output-style. git-archimport-id: mwolson@gnu.org--2006/muse--main--1.0--patch-161 --- ChangeLog | 25 +++++++++++++++++++++++++ lisp/muse-project.el | 31 +++++++++++++++++++++---------- lisp/muse-wiki.el | 5 +---- 3 files changed, 47 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 38ec629..ac15572 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,31 @@ # arch-tag: automatic-ChangeLog--mwolson@gnu.org--2006/muse--main--1.0 # +2006-07-04 05:00:35 GMT Michael Olson patch-161 + + Summary: + Fix publishing bug introduced in last patch. + Revision: + muse--main--1.0--patch-161 + + * lisp/muse-project.el (muse-current-output-style): New variable that + holds the output style that is currently being used to publish a file. + (muse-project-page-file): When a subdirectory is used, only record + matches. Sort using matches, not entire list. + (muse-project-resolve-link): Docfix. + (muse-project-current-output-style): New function that returns the + current output style. + (muse-project-link-page): Use the local output style, not the other + kind of style. + (muse-project-publish-file): Set muse-current-output-style. + + * lisp/muse-wiki.el (muse-wiki-resolve-project-page): Use + muse-current-output-style. + + modified files: + ChangeLog lisp/muse-project.el lisp/muse-wiki.el + + 2006-07-04 04:06:44 GMT Michael Olson patch-160 Summary: diff --git a/lisp/muse-project.el b/lisp/muse-project.el index a64d28d..030030e 100644 --- a/lisp/muse-project.el +++ b/lisp/muse-project.el @@ -301,6 +301,9 @@ For an example of the use of this function, see "Project we are currently visiting.") (make-variable-buffer-local 'muse-current-project) +(defvar muse-current-output-style nil + "The output style that we are currently using for publishing files.") + (defsubst muse-project (&optional project) "Resolve the given PROJECT into a full Muse project, if it is a string." (if (null project) @@ -323,12 +326,12 @@ For an example of the use of this function, see (if dir (save-match-data (dolist (file files) - (setq matches (cons (cons (string-match - (concat (regexp-quote dir) "\\'") - (file-name-directory (cdr file))) - (cdr file)) - matches))) - (car (muse-sort-by-rating files))) + (let ((pos (string-match (concat (regexp-quote dir) "\\'") + (file-name-directory (cdr file))))) + (when pos + (setq matches (cons (cons pos (cdr file)) + matches))))) + (car (muse-sort-by-rating matches))) (dolist (file files) (setq matches (cons (cons (length (cdr file)) (cdr file)) matches))) @@ -598,8 +601,7 @@ The name of a project may be used for STYLES." to another file. The best match for PAGE is determined by comparing the link -suffix of the given potential local style and that of the remote -styles. +suffix of the given local style and that of the remote styles. The remote styles are usually populated by `muse-project-applicable-styles'." @@ -624,9 +626,17 @@ The remote styles are usually populated by (muse-style-element :path local-style)))))) nil remote-style))) +(defun muse-project-current-output-style (&optional file project) + (or muse-current-output-style + (progn + (unless file (setq file (muse-current-file))) + (unless project (setq project (muse-project-of-file file))) + (car (muse-project-applicable-styles file (cddr project)))))) + (defun muse-project-link-page (page) (let ((project (muse-project-of-file))) - (muse-project-resolve-link page (muse-style) + (muse-project-resolve-link page + (muse-project-current-output-style) (muse-project-applicable-styles (muse-project-page-file page project) (cddr project))))) @@ -635,7 +645,8 @@ The remote styles are usually populated by (setq styles (muse-project-applicable-styles file styles ignore-regexp)) (let (published) (dolist (style styles) - (let ((output-dir (muse-style-element :path style))) + (let ((output-dir (muse-style-element :path style)) + (muse-current-output-style style)) ;; ensure the publishing location is available (unless (file-exists-p output-dir) (message "Creating publishing directory %s" output-dir) diff --git a/lisp/muse-wiki.el b/lisp/muse-wiki.el index 6934720..e3022b1 100644 --- a/lisp/muse-wiki.el +++ b/lisp/muse-wiki.el @@ -241,10 +241,7 @@ use the first style we find." (let* ((page-path (muse-project-page-file page project)) (remote-styles (when page-path (muse-project-applicable-styles page-path (cddr project)))) - (local-style (or (muse-style) - (car (muse-project-applicable-styles - (muse-current-file) - (cddr (muse-project-of-file))))))) + (local-style (muse-project-current-output-style page-path project))) (cond ((and remote-styles local-style muse-publishing-p) (muse-project-resolve-link page local-style remote-styles)) ((not muse-publishing-p) -- 2.11.4.GIT