1 ;;; muse.el --- an authoring and publishing tool for Emacs
3 ;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
5 ;; Emacs Lisp Archive Entry
7 ;; Version: 3.02.93 (3.03 RC3)
8 ;; Date: Fri 7-Apr-2006
9 ;; Keywords: hypermedia
10 ;; Author: John Wiegley (johnw AT gnu DOT org)
11 ;; Maintainer: Michael Olson (mwolson AT gnu DOT org)
12 ;; Description: An authoring and publishing tool for Emacs
13 ;; URL: http://www.mwolson.org/projects/EmacsMuse.html
14 ;; Compatibility: Emacs21 XEmacs21 Emacs22
16 ;; This file is part of Emacs Muse. It is not part of GNU Emacs.
18 ;; Emacs Muse is free software; you can redistribute it and/or modify
19 ;; it under the terms of the GNU General Public License as published
20 ;; by the Free Software Foundation; either version 2, or (at your
21 ;; option) any later version.
23 ;; Emacs Muse is distributed in the hope that it will be useful, but
24 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
25 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 ;; General Public License for more details.
28 ;; You should have received a copy of the GNU General Public License
29 ;; along with Emacs Muse; see the file COPYING. If not, write to the
30 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
31 ;; Boston, MA 02110-1301, USA.
35 ;; Muse is a tool for easily authoring and publishing documents. It
36 ;; allows for rapid prototyping of hyperlinked text, which may then be
37 ;; exported to multiple output formats -- such as HTML, LaTeX,
40 ;; The markup rules used by Muse are intended to be very friendly to
41 ;; people familiar with Emacs. See the included manual for more
48 ;; Indicate that this version of Muse supports nested tags
49 (provide 'muse-nested-tags
)
51 (defvar muse-version
"3.02.93"
52 "The version of Muse currently loaded")
54 (defun muse-version (&optional insert
)
55 "Display the version of Muse that is currently loaded.
56 If INSERT is non-nil, insert the text instead of displaying it."
60 (message muse-version
)))
63 "Options controlling the behavior of Muse.
64 The markup used by Muse is intended to be very friendly to people
68 (defvar muse-under-windows-p
(memq system-type
'(ms-dos windows-nt
)))
73 (require 'muse-regexps
)
75 (defvar muse-update-values-hook nil
76 "Hook for values that are automatically generated.
77 This is to be used by add-on modules for Muse.
78 It is run just before colorizing or publishing a buffer.")
80 ;; Default file extension
83 (defvar muse-ignored-extensions
))
85 (defvar muse-ignored-extensions-regexp nil
86 "A regexp of extensions to omit from the ending of a Muse page name.
87 This is autogenerated from `muse-ignored-extensions'.")
89 (defun muse-update-file-extension (sym val
)
90 "Update the value of `muse-file-extension'."
91 (when (and (featurep 'muse-mode
)
92 (boundp sym
) (stringp (symbol-value sym
))
93 (or (not (stringp val
))
94 (not (string= (symbol-value sym
) val
))))
95 ;; remove old auto-mode-alist association
97 (delete (cons (concat "\\." (symbol-value sym
) "\\'")
98 'muse-mode-choose-mode
)
101 ;; associate .muse with muse-mode
102 (when (and (featurep 'muse-mode
)
104 (or (not (stringp (symbol-value sym
)))
105 (not (string= (symbol-value sym
) val
))))
106 (add-to-list 'auto-mode-alist
107 (cons (concat "\\." val
"\\'")
108 'muse-mode-choose-mode
)))
109 ;; update the ignored extensions regexp
110 (when (and (fboundp 'muse-update-ignored-extensions-regexp
)
111 (or (not (stringp (symbol-value sym
)))
113 (not (string= (symbol-value sym
) val
))))
114 (muse-update-ignored-extensions-regexp
115 'muse-ignored-extensions muse-ignored-extensions
)))
117 (defcustom muse-file-extension
"muse"
118 "File extension of Muse files. Omit the period at the beginning.
119 If you don't want Muse files to have an extension, set this to nil."
121 (const :tag
"None" nil
)
123 :set
'muse-update-file-extension
126 (defun muse-update-ignored-extensions-regexp (sym val
)
127 "Update the value of `muse-ignored-extensions-regexp'."
130 (setq muse-ignored-extensions-regexp
132 (regexp-quote (or muse-file-extension
"")) "\\|"
133 (mapconcat 'identity val
"\\|")
135 (setq muse-ignored-extensions-regexp
136 (if muse-file-extension
137 (concat "\\.\\(" muse-file-extension
"\\)\\'")
140 (add-hook 'muse-update-values-hook
142 (muse-update-ignored-extensions-regexp
143 'muse-ignored-extensions muse-ignored-extensions
)))
145 (defcustom muse-ignored-extensions
'("bz2" "gz" "[Zz]")
146 "A list of extensions to omit from the ending of a Muse page name.
149 Don't put a period at the beginning of each extension unless you
150 understand that it is part of a regexp."
151 :type
'(repeat (regexp :tag
"Extension"))
152 :set
'muse-update-ignored-extensions-regexp
155 (add-to-list 'auto-mode-alist
156 (cons (concat "\\." muse-file-extension
"\\'")
157 'muse-mode-choose-mode
))
159 (defun muse-update-file-extension-after-init ()
160 ;; This is short, but it has to be a function, otherwise Emacs21
161 ;; does not load it properly when running after-init-hook
162 (muse-update-file-extension 'muse-file-extension muse-file-extension
))
164 ;; Once the user's init file has been processed, determine whether
165 ;; they want a file extension
166 (add-hook 'after-init-hook
'muse-update-file-extension-after-init
)
170 (require 'muse-protocols
)
174 (defsubst muse-delete-file-if-exists
(file)
175 (when (file-exists-p file
)
177 (message "Removed %s" file
)))
179 (defsubst muse-time-less-p
(t1 t2
)
180 "Say whether time T1 is less than time T2."
181 (or (< (car t1
) (car t2
))
182 (and (= (car t1
) (car t2
))
183 (< (nth 1 t1
) (nth 1 t2
)))))
186 (defvar muse-publishing-current-file nil
))
188 (defun muse-current-file ()
189 "Return the name of the currently visited or published file."
190 (or (and (boundp 'muse-publishing-current-file
)
191 muse-publishing-current-file
)
193 (concat default-directory
(buffer-name))))
195 (defun muse-page-name (&optional name
)
196 "Return the canonical form of a Muse page name.
197 All this means is that certain extensions, like .gz, are removed."
199 (unless (and name
(not (string= name
"")))
200 (setq name
(muse-current-file)))
202 (let ((page (file-name-nondirectory name
)))
203 (if (and muse-ignored-extensions-regexp
204 (string-match muse-ignored-extensions-regexp page
))
205 (replace-match "" t t page
)
208 (defun muse-display-warning (message)
209 "Display the given MESSAGE as a warning."
210 (if (fboundp 'display-warning
)
211 (display-warning 'muse message
212 (if (featurep 'xemacs
)
215 (let ((buf (get-buffer-create "*Muse warnings*")))
216 (with-current-buffer buf
217 (goto-char (point-max))
218 (insert "Warning (muse): " message
)
224 (defun muse-eval-lisp (form)
225 "Evaluate the given form and return the result as a string."
229 (let ((object (eval (read form
))))
231 ((stringp object
) object
)
233 (not (eq object nil
)))
234 (let ((string (pp-to-string object
)))
235 (substring string
0 (1- (length string
)))))
237 (number-to-string object
))
240 (pp-to-string object
))))
242 (muse-display-warning (format "%s: Error evaluating %s: %s"
243 (muse-page-name) form err
))
244 "; INVALID LISP CODE"))))
246 (defmacro muse-with-temp-buffer
(&rest body
)
247 "Create a temporary buffer, and evaluate BODY there like `progn'.
248 See also `with-temp-file' and `with-output-to-string'.
250 Unlike `with-temp-buffer', this will never attempt to save the temp buffer.
251 It is meant to be used along with `insert-file-contents'."
252 (let ((temp-buffer (make-symbol "temp-buffer")))
253 `(let ((,temp-buffer
(generate-new-buffer " *muse-temp*")))
256 (with-current-buffer ,temp-buffer
259 (with-current-buffer ,temp-buffer
262 (if (and (boundp 'muse-batch-publishing-p
)
263 muse-batch-publishing-p
)
265 (message "%s: Error occured: %s"
266 (muse-page-name) err
)
268 (muse-display-warning
269 (format (concat "An error occurred while publishing"
270 " %s: %s\n\nSet debug-on-error to"
271 " `t' if you would like a backtrace.")
272 (muse-page-name) err
))))))
273 (when (buffer-live-p ,temp-buffer
)
274 (with-current-buffer ,temp-buffer
275 (set-buffer-modified-p nil
))
276 (unless debug-on-error
(kill-buffer ,temp-buffer
)))))))
278 (put 'muse-with-temp-buffer
'lisp-indent-function
0)
279 (put 'muse-with-temp-buffer
'edebug-form-spec
'(body))
281 (defun muse-collect-alist (list element
&optional test
)
282 "Collect items from LIST whose car is equal to ELEMENT.
283 If TEST is specified, use it to compare ELEMENT."
284 (unless test
(setq test
'equal
))
287 (when (funcall test element
(car item
))
288 (setq items
(cons item items
))))
291 (defmacro muse-sort-with-closure
(list predicate closure
)
292 "Sort LIST, stably, comparing elements using PREDICATE.
293 Returns the sorted list. LIST is modified by side effects.
294 PREDICATE is called with two elements of list and CLOSURE.
295 PREDICATE should return non-nil if the first element should sort
297 `(sort ,list
(lambda (a b
) (funcall ,predicate a b
,closure
))))
299 (put 'muse-sort-with-closure
'lisp-indent-function
0)
300 (put 'muse-sort-with-closure
'edebug-form-spec
'(form function-form form
))
302 (defun muse-sort-by-rating (rated-list &optional test
)
303 "Sort RATED-LIST according to the rating of each element.
304 The rating is stripped out in the returned list.
305 Default sorting is highest-first.
307 If TEST if specified, use it to sort the list."
308 (unless test
(setq test
'>))
309 (mapcar (function cdr
)
310 (muse-sort-with-closure
312 (lambda (a b closure
)
313 (let ((na (numberp (car a
)))
314 (nb (numberp (car b
))))
315 (cond ((and na nb
) (funcall closure
(car a
) (car b
)))
320 (defun muse-escape-specials-in-string (specials string
&optional reverse
)
321 "Apply the transformations in SPECIALS to STRING.
323 The transforms should form a fully reversible and non-ambiguous
324 syntax when STRING is parsed from left to right.
326 If REVERSE is specified, reverse an already-escaped string."
327 (let ((rules (mapcar (lambda (rule)
328 (cons (regexp-quote (if reverse
331 (if reverse
(car rule
) (cdr rule
))))
335 (goto-char (point-min))
338 (unless (catch 'found
340 (when (looking-at (car rule
))
341 (replace-match (cdr rule
) t t
)
346 (defun muse-trim-whitespace (string)
347 "Return a version of STRING with no initial nor trailing whitespace."
348 (muse-replace-regexp-in-string
349 (concat "\\`[" muse-regexp-blank
"]+\\|[" muse-regexp-blank
"]+\\'")
352 (defun muse-path-sans-extension (path)
353 "Return PATH sans final \"extension\".
355 The extension, in a file name, is the part that follows the last `.',
356 except that a leading `.', if any, doesn't count.
358 This differs from `file-name-sans-extension' in that it will
359 never modify the directory part of the path."
360 (concat (file-name-directory path
)
361 (file-name-nondirectory (file-name-sans-extension path
))))
363 ;; The following code was extracted from cl
365 (defun muse-const-expr-p (x)
367 (or (eq (car x
) 'quote
)
368 (and (memq (car x
) '(function function
*))
369 (or (symbolp (nth 1 x
))
370 (and (eq (and (consp (nth 1 x
))
371 (car (nth 1 x
))) 'lambda
) 'func
)))))
372 ((symbolp x
) (and (memq x
'(nil t
)) t
))
375 (put 'muse-assertion-failed
'error-conditions
'(error))
376 (put 'muse-assertion-failed
'error-message
"Assertion failed")
378 (defun muse-list* (arg &rest rest
)
379 "Return a new list with specified args as elements, cons'd to last arg.
380 Thus, `(list* A B C D)' is equivalent to `(nconc (list A B C) D)', or to
381 `(cons A (cons B (cons C D)))'."
382 (cond ((not rest
) arg
)
383 ((not (cdr rest
)) (cons arg
(car rest
)))
384 (t (let* ((n (length rest
))
385 (copy (copy-sequence rest
))
386 (last (nthcdr (- n
2) copy
)))
387 (setcdr last
(car (cdr last
)))
390 (defmacro muse-assert
(form &optional show-args string
&rest args
)
391 "Verify that FORM returns non-nil; signal an error if not.
392 Second arg SHOW-ARGS means to include arguments of FORM in message.
393 Other args STRING and ARGS... are arguments to be passed to `error'.
394 They are not evaluated unless the assertion fails. If STRING is
395 omitted, a default message listing FORM itself is used."
401 (and (not (muse-const-expr-p x
)) x
)))
406 (muse-list* 'error string
(append sargs args
))
407 (list 'signal
'(quote muse-assertion-failed
)
408 (muse-list* 'list
(list 'quote form
) sargs
))))
411 ;; Compatibility functions
413 (if (fboundp 'looking-back
)
414 (defalias 'muse-looking-back
'looking-back
)
415 (defun muse-looking-back (regexp &optional limit
&rest ignored
)
417 (re-search-backward (concat "\\(?:" regexp
"\\)\\=") limit t
))))
419 (if (fboundp 'line-end-position
)
420 (defalias 'muse-line-end-position
'line-end-position
)
421 (defun muse-line-end-position (&optional n
)
422 (save-excursion (end-of-line n
) (point))))
424 (if (fboundp 'line-beginning-position
)
425 (defalias 'muse-line-beginning-position
'line-beginning-position
)
426 (defun muse-line-beginning-position (&optional n
)
427 (save-excursion (beginning-of-line n
) (point))))
430 (if (fboundp 'match-string-no-properties
)
431 (defalias 'muse-match-string-no-properties
'match-string-no-properties
)
432 (defun muse-match-string-no-properties (num &optional string
)
433 (match-string num string
))))
435 (defun muse-replace-regexp-in-string (regexp replacement text
&optional fixedcase literal
)
436 "Replace REGEXP with REPLACEMENT in TEXT.
438 Return a new string containing the replacements.
440 If fourth arg FIXEDCASE is non-nil, do not alter case of replacement text.
441 If fifth arg LITERAL is non-nil, insert REPLACEMENT literally."
443 ((fboundp 'replace-in-string
)
444 (replace-in-string text regexp replacement literal
))
445 ((fboundp 'replace-regexp-in-string
)
446 (replace-regexp-in-string regexp replacement text fixedcase literal
))
447 (t (let ((repl-len (length replacement
))
449 (unless (string= regexp
"")
451 (while (setq start
(string-match regexp text start
))
452 (setq start
(+ start repl-len
)
453 text
(replace-match replacement fixedcase literal
457 (if (fboundp 'add-to-invisibility-spec
)
458 (defalias 'muse-add-to-invisibility-spec
'add-to-invisibility-spec
)
459 (defun muse-add-to-invisibility-spec (element)
460 "Add ELEMENT to `buffer-invisibility-spec'.
461 See documentation for `buffer-invisibility-spec' for the kind of elements
463 (if (eq buffer-invisibility-spec t
)
464 (setq buffer-invisibility-spec
(list t
)))
465 (setq buffer-invisibility-spec
466 (cons element buffer-invisibility-spec
))))
468 (if (fboundp 'read-directory-name
)
469 (defalias 'muse-read-directory-name
'read-directory-name
)
470 (defun muse-read-directory-name (prompt &optional dir default-dirname mustmatch initial
)
471 "Read directory name - see `read-file-name' for details."
473 (setq dir default-directory
))
474 (read-file-name prompt dir
(or default-dirname
475 (if initial
(expand-file-name initial dir
)
479 (defun muse-file-remote-p (file)
480 "Test whether FILE specifies a location on a remote system.
481 Return non-nil if the location is indeed remote.
483 For example, the filename \"/user@host:/foo\" specifies a location
484 on the system \"/user@host:\"."
485 (cond ((fboundp 'file-remote-p
)
486 (file-remote-p file
))
487 ((fboundp 'tramp-handle-file-remote-p
)
488 (tramp-handle-file-remote-p file
))
489 ((and (boundp 'ange-ftp-name-format
)
490 (string-match ange-ftp-name-format file
))
494 ;; Set face globally in a predictable fashion
495 (defun muse-copy-face (old new
)
496 "Copy face OLD to NEW."
497 (if (featurep 'xemacs
)
498 (copy-face old new
'all
)
499 (copy-face old new
)))
501 ;; Widget compatibility functions
503 (defun muse-widget-type-value-create (widget)
504 "Convert and instantiate the value of the :type attribute of WIDGET.
505 Store the newly created widget in the :children attribute.
507 The value of the :type attribute should be an unconverted widget type."
508 (let ((value (widget-get widget
:value
))
509 (type (widget-get widget
:type
)))
510 (widget-put widget
:children
511 (list (widget-create-child-value widget
512 (widget-convert type
)
515 (defun muse-widget-child-value-get (widget)
516 "Get the value of the first member of :children in WIDGET."
517 (widget-value (car (widget-get widget
:children
))))
519 (defun muse-widget-type-match (widget value
)
520 "Non-nil if the :type value of WIDGET matches VALUE.
522 The value of the :type attribute should be an unconverted widget type."
523 (widget-apply (widget-convert (widget-get widget
:type
)) :match value
))
525 ;; Link-handling functions and variables
527 (defun muse-get-link (&optional target
)
528 "Based on the match data, retrieve the link.
529 Use TARGET to get the string, if it is specified."
530 (muse-match-string-no-properties 1 target
))
532 (defun muse-get-link-desc (&optional target
)
533 "Based on the match data, retrieve the link description.
534 Use TARGET to get the string, if it is specified."
535 (muse-match-string-no-properties 2 target
))
537 (defvar muse-link-specials
541 "Syntax used for escaping and unescaping links.
542 This allows brackets to occur in explicit links as long as you
543 use the standard Muse functions to create them.")
545 (defun muse-link-escape (text)
546 "Escape characters in TEXT that conflict with the explicit link
549 (muse-escape-specials-in-string muse-link-specials text
)))
551 (defun muse-link-unescape (text)
552 "Un-escape characters in TEXT that conflict with the explicit
555 (muse-escape-specials-in-string muse-link-specials text t
)))
557 (defun muse-handle-url (&optional string
)
558 "If STRING or point has a URL, match and return it."
559 (if (if string
(string-match muse-url-regexp string
)
560 (looking-at muse-url-regexp
))
561 (match-string 0 string
)))
563 (defcustom muse-implicit-link-functions
'(muse-handle-url)
564 "A list of functions to handle an implicit link.
565 An implicit link is one that is not surrounded by brackets.
567 By default, Muse handles URLs only.
568 If you want to handle WikiWords, load muse-wiki.el."
570 :options
'(muse-handle-url)
573 (defun muse-handle-implicit-link (&optional link
)
574 "Handle implicit links. If LINK is not specified, look at point.
575 An implicit link is one that is not surrounded by brackets.
576 By default, Muse handles URLs only.
577 If you want to handle WikiWords, load muse-wiki.el.
579 This function modifies the match data so that match 1 is the
580 link. Match 2 will usually be nil, unless the description is
581 embedded in the text of the buffer.
583 The match data is restored after each unsuccessful handler
584 function call. If LINK is specified, only restore at very end.
586 This behavior is needed because the part of the buffer that
587 `muse-implicit-link-regexp' matches must be narrowed to the part
588 that is an accepted link."
589 (let ((funcs muse-implicit-link-functions
)
591 (data (match-data t
)))
593 (setq res
(funcall (car funcs
) link
))
596 (unless link
(set-match-data data
))
597 (setq funcs
(cdr funcs
))))
598 (when link
(set-match-data data
))
601 (defcustom muse-explicit-link-functions nil
602 "A list of functions to handle an explicit link.
603 An explicit link is one [[like][this]] or [[this]]."
607 (defun muse-handle-explicit-link (&optional link
)
608 "Handle explicit links. If LINK is not specified, look at point.
609 An explicit link is one that looks [[like][this]] or [[this]].
611 This function modifies the match data so that match 1 is the link
612 and match 2 is the description. Perhaps someday match 3 might be
613 the text to use for the alt element of an <a> or <img> tag.
615 The match data is saved. If no handlers are able to process
616 LINK, return LINK (if specified) or the 1st match string. If
617 LINK is not specified, it is assumed that Muse has matched
618 against `muse-explicit-link-regexp' before calling this
620 (let ((funcs muse-explicit-link-functions
)
624 (setq res
(funcall (car funcs
) link
))
627 (setq funcs
(cdr funcs
)))))
631 (or link
(muse-get-link))))))
633 ;; Movement functions
635 (defun muse-list-item-type (str)
636 "Determine the type of list given STR.
637 Returns either 'ul, 'ol, 'dl-term, or 'dl-entry."
638 (cond ((or (string= str
"")
641 ((and (= (aref str
0) ?\
)
645 (string-match (concat "\\`[" muse-regexp-blank
"][0-9]+\\.") str
))
648 (not (string-match (concat "\\`[" muse-regexp-blank
"]*::") str
)))
649 ;; if str is not any kind of list, it will be interpreted as
654 (defun muse-list-item-critical-point (&optional offset
)
655 "Figure out where the important markup character for the
656 currently-matched list item is.
658 If OFFSET is specified, it is the number of groupings outside of
659 the contents of `muse-list-item-regexp'."
660 (unless offset
(setq offset
0))
661 (if (match-end (+ offset
2))
662 ;; at a definition list
663 (match-end (+ offset
2))
664 ;; at a different kind of list
665 (match-beginning (+ offset
1))))
667 (defun muse-forward-paragraph (&optional pattern
)
668 "Move forward safely by one paragraph, or according to PATTERN."
669 (when (get-text-property (point) 'end-list
)
670 (goto-char (next-single-property-change (point) 'end-list
)))
671 (setq pattern
(if pattern
672 (concat "^\\(?:" pattern
"\\|\n\\|\\'\\)")
673 "^\\s-*\\(\n\\|\\'\\)"))
674 (let ((next-list-end (or (next-single-property-change (point) 'end-list
)
677 (if (re-search-forward pattern nil t
)
678 (goto-char (match-beginning 0))
679 (goto-char (point-max)))
680 (when (> (point) next-list-end
)
681 (goto-char next-list-end
))))
683 (defun muse-forward-list-item-1 (type empty-line indented-line
)
684 "Determine whether a nested list item is after point."
685 (if (match-beginning 1)
686 ;; if we are given a dl entry, skip past everything on the same
687 ;; level, except for other dl entries
688 (and (eq type
'dl-entry
)
689 (not (eq (char-after (match-beginning 2)) ?\
:)))
690 ;; blank line encountered with no list item on the same
695 (and (looking-at indented-line
)
696 (not (looking-at empty-line
))))
697 ;; found that this blank line is followed by some
698 ;; indentation, plus other text, so we'll keep
704 (defun muse-forward-list-item (type indent
&optional no-skip-nested
)
705 "Move forward to the next item of TYPE.
706 Return non-nil if successful, nil otherwise.
707 The beginning indentation is given by INDENT.
709 If NO-SKIP-NESTED is non-nil, do not skip past nested items.
710 Note that if you desire this behavior, you will also need to
711 provide a very liberal INDENT value, such as
712 \(concat \"[\" muse-regexp-blank \"]*\")."
713 (let* ((list-item (format muse-list-item-regexp indent
))
714 (empty-line (concat "^[" muse-regexp-blank
"]*\n"))
715 (indented-line (concat "^" indent
"[" muse-regexp-blank
"]"))
716 (list-pattern (concat "\\(?:" empty-line
"\\)?"
717 "\\(" list-item
"\\)")))
719 (muse-forward-paragraph list-pattern
)
720 ;; make sure we don't go past boundary
721 (and (not (or (get-text-property (point) 'end-list
)
722 (>= (point) (point-max))))
723 ;; move past markup that is part of another construct
724 (or (and (match-beginning 1)
725 (or (get-text-property
726 (muse-list-item-critical-point 1) 'muse-link
)
728 (muse-list-item-critical-point 1) 'face
)))
730 (and (not no-skip-nested
)
731 (muse-forward-list-item-1 type empty-line
733 (cond ((or (get-text-property (point) 'end-list
)
734 (>= (point) (point-max)))
735 ;; at a list boundary, so stop
737 ((and (match-string 2)
738 (eq type
(muse-list-item-type (match-string 2))))
739 ;; same type, so indicate that there are more items to be
741 (goto-char (match-beginning 1)))
743 (when (match-beginning 1)
744 (goto-char (match-beginning 1)))
745 ;; move to just before foreign list item markup
748 (defun muse-goto-tag-end (tag nested
)
749 "Move forward past the end of TAG.
751 If NESTED is non-nil, look for other instances of this tag that
752 may be nested inside of this tag, and skip past them."
754 (search-forward (concat "</" tag
">") nil t
)
756 (tag-regexp (concat "^\\(<\\(/?\\)" tag
">\\)"))
758 (while (and (> nesting
0)
759 (setq match-found
(re-search-forward tag-regexp nil t
)))
760 (if (string-equal (match-string 2) "/")
761 (setq nesting
(1- nesting
))
762 (setq nesting
(1+ nesting
))))
765 ;;; muse.el ends here