From 0c6524494819be5d74388a2dcd1c0c8fba9d0669 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Thu, 27 Jul 2006 20:46:38 +0000 Subject: [PATCH] Make C-c C-t publish the current file in a more sensible way. * lisp/muse-mode.el (muse-mode-map): Make C-c C-t call muse-project-publish-this-file instead of muse-publish-this file. Make C-c C-T call the latter. (muse-browse-result): Use `muse-project-get-applicable-styles'. (muse-follow-name-at-point): Docfix. * lisp/muse-project.el (muse-project-get-applicable-style): New function that prompts the user for a style if more than one style applies to the given file. (muse-project-publish-this-file): New function that publishes the currently-visited file according to `muse-project-alist', prompting if more than one style applies. * lisp/muse-publish.el (muse-publish-this-file): Docfix. * muse.texi (Keystroke Summary): Update for the changes made. C-c C-c was not previously documented. git-archimport-id: mwolson@gnu.org--2006/muse--main--1.0--patch-166 --- ChangeLog | 30 ++++++++++++++++++++++++++++++ lisp/muse-mode.el | 17 ++++++++--------- lisp/muse-project.el | 22 ++++++++++++++++++++++ lisp/muse-publish.el | 6 ++++-- muse.texi | 11 +++++++++++ 5 files changed, 75 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 66350ff..123aea3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,36 @@ # arch-tag: automatic-ChangeLog--mwolson@gnu.org--2006/muse--main--1.0 # +2006-07-27 20:46:38 GMT Michael Olson patch-166 + + Summary: + Make C-c C-t publish the current file in a more sensible way. + Revision: + muse--main--1.0--patch-166 + + * lisp/muse-mode.el (muse-mode-map): Make C-c C-t call + muse-project-publish-this-file instead of muse-publish-this file. Make + C-c C-T call the latter. + (muse-browse-result): Use `muse-project-get-applicable-styles'. + (muse-follow-name-at-point): Docfix. + + * lisp/muse-project.el (muse-project-get-applicable-style): New function + that prompts the user for a style if more than one style applies to the + given file. + (muse-project-publish-this-file): New function that publishes the + currently-visited file according to `muse-project-alist', prompting if + more than one style applies. + + * lisp/muse-publish.el (muse-publish-this-file): Docfix. + + * muse.texi (Keystroke Summary): Update for the changes made. C-c C-c + was not previously documented. + + modified files: + ChangeLog lisp/muse-mode.el lisp/muse-project.el + lisp/muse-publish.el muse.texi + + 2006-07-27 19:36:31 GMT Michael Olson patch-165 Summary: diff --git a/lisp/muse-mode.el b/lisp/muse-mode.el index 4e209be..a550d33 100644 --- a/lisp/muse-mode.el +++ b/lisp/muse-mode.el @@ -143,7 +143,9 @@ index at intervals." (define-key map [(control ?c) (control ?c)] 'muse-follow-name-at-point) (define-key map [(control ?c) (control ?e)] 'muse-edit-link-at-point) (define-key map [(control ?c) (control ?l)] 'font-lock-mode) - (define-key map [(control ?c) (control ?t)] 'muse-publish-this-file) + (define-key map [(control ?c) (control ?t)] + 'muse-project-publish-this-file) + (define-key map [(control ?c) (control ?T)] 'muse-publish-this-file) (define-key map [(control ?c) (control ?v)] 'muse-browse-result) (define-key map [(control ?c) ?=] 'muse-what-changed) @@ -562,13 +564,10 @@ in `muse-project-alist'." ;;;###autoload (defun muse-browse-result (style &optional other-window) "Visit the current page's published result." - (interactive (list (muse-publish-get-style - (mapcar - (lambda (style) - (cons (muse-get-keyword :base style) style)) - (muse-project-applicable-styles - buffer-file-name (cddr muse-current-project)))) - current-prefix-arg)) + (interactive + (list (muse-project-get-applicable-style buffer-file-name + (cddr muse-current-project)) + current-prefix-arg)) (setq style (muse-style style)) (let ((result-path (muse-publish-output-file buffer-file-name @@ -585,7 +584,7 @@ in `muse-project-alist'." ;;;###autoload (defun muse-follow-name-at-point (&optional other-window) - "Visit the link at point, or insert a newline if none is found." + "Visit the link at point." (interactive "P") (let ((link (muse-link-at-point))) (if link diff --git a/lisp/muse-project.el b/lisp/muse-project.el index 030030e..912ccc3 100644 --- a/lisp/muse-project.el +++ b/lisp/muse-project.el @@ -596,6 +596,14 @@ The name of a project may be used for STYLES." (setq used-styles (cons (cons rating style) used-styles))))) (muse-sort-by-rating (nreverse used-styles))))) +(defun muse-project-get-applicable-style (file styles) + "Choose a style from the STYLES that FILE can publish to. +The user is prompted if several styles are found." + (muse-publish-get-style (mapcar + (lambda (style) + (cons (muse-get-keyword :base style) style)) + (muse-project-applicable-styles file styles)))) + (defun muse-project-resolve-link (page local-style remote-styles) "Return a published relative link from the output path of one file to another file. @@ -656,6 +664,20 @@ The remote styles are usually populated by (setq published t)))) published)) +;;;###autoload +(defun muse-project-publish-this-file (&optional force) + "Publish the currently-visited file according to `muse-project-alist', +prompting if more than one style applies. + +If FORCE is given, publish the file even if it is up-to-date." + (interactive (list current-prefix-arg)) + (let* ((style (muse-project-get-applicable-style + buffer-file-name (cddr muse-current-project))) + (output-dir (muse-style-element :path style))) + (unless (muse-publish-file buffer-file-name style output-dir force) + (message (concat "The published version is up-to-date; use" + " C-u C-c C-t to force an update."))))) + (defun muse-project-save-buffers (&optional project) (setq project (muse-project project)) (map-y-or-n-p diff --git a/lisp/muse-publish.el b/lisp/muse-publish.el index d30f1a1..3b8b436 100644 --- a/lisp/muse-publish.el +++ b/lisp/muse-publish.el @@ -651,11 +651,13 @@ the file is published no matter what." ;;;###autoload (defun muse-publish-this-file (style output-dir &optional force) - "Publish the page in the current file." + "Publish the currently-visited file. +Prompt for both the STYLE and OUTPUT-DIR if they are not +supplied." (interactive (muse-publish-get-info)) (unless (muse-publish-file buffer-file-name style output-dir force) (message (concat "The published version is up-to-date; use" - " C-u C-c C-t to force an update.")))) + " C-u C-c C-T to force an update.")))) (defun muse-batch-publish-files () "Publish Muse files in batch mode." diff --git a/muse.texi b/muse.texi index 0a38256..093861a 100644 --- a/muse.texi +++ b/muse.texi @@ -426,6 +426,9 @@ Display an index of all known Muse pages. @item C-c C-b (`muse-find-backlinks') Find all pages that link to this page. +@item C-c C-c (`muse-follow-name-at-point') +Visit the link at point. + @item C-c C-e (`muse-edit-link-at-point') Edit link at point. @@ -444,6 +447,14 @@ Publish any Muse pages that have changed. @item C-c C-s (`muse-search') Find text in all files of the current project. +@item C-c C-t (`muse-project-publish-this-file') +Publish the currently-visited file. Prompt for the style if the current +file can be published using more than one style. + +@item C-c C-T (`muse-publish-this-file') +Publish the currently-visited file. Prompt for both the style and +output directory. + @item C-c C-v (`muse-browse-result') Show the published result of this page. -- 2.11.4.GIT