1 ;;; muse.el --- an authoring and publishing tool for Emacs
3 ;; Copyright (C) 2004, 2005, 2006, 2007 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://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
82 ;; By default, use the .muse file extension.
83 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.muse\\'" . muse-mode-choose-mode))
85 ;; We need to have this at top-level, as well, so that any Muse or
86 ;; Planner documents opened during init will just work.
87 (add-to-list 'auto-mode-alist
'("\\.muse\\'" . muse-mode-choose-mode
))
90 (defvar muse-ignored-extensions
))
92 (defvar muse-ignored-extensions-regexp nil
93 "A regexp of extensions to omit from the ending of a Muse page name.
94 This is autogenerated from `muse-ignored-extensions'.")
96 (defun muse-update-file-extension (sym val
)
97 "Update the value of `muse-file-extension'."
98 (when (and (featurep 'muse-mode
)
99 (boundp sym
) (stringp (symbol-value sym
))
100 (or (not (stringp val
))
101 (not (string= (symbol-value sym
) val
))))
102 ;; remove old auto-mode-alist association
103 (setq auto-mode-alist
104 (delete (cons (concat "\\." (symbol-value sym
) "\\'")
105 'muse-mode-choose-mode
)
108 ;; associate the new file extension with muse-mode
109 (when (and (featurep 'muse-mode
)
111 (or (not (stringp (symbol-value sym
)))
112 (not (string= (symbol-value sym
) val
))))
113 (add-to-list 'auto-mode-alist
114 (cons (concat "\\." val
"\\'")
115 'muse-mode-choose-mode
)))
116 ;; update the ignored extensions regexp
117 (when (and (fboundp 'muse-update-ignored-extensions-regexp
)
118 (or (not (stringp (symbol-value sym
)))
120 (not (string= (symbol-value sym
) val
))))
121 (muse-update-ignored-extensions-regexp
122 'muse-ignored-extensions muse-ignored-extensions
)))
124 (defcustom muse-file-extension
"muse"
125 "File extension of Muse files. Omit the period at the beginning.
126 If you don't want Muse files to have an extension, set this to nil."
128 (const :tag
"None" nil
)
130 :set
'muse-update-file-extension
133 (defun muse-update-ignored-extensions-regexp (sym val
)
134 "Update the value of `muse-ignored-extensions-regexp'."
137 (setq muse-ignored-extensions-regexp
139 (regexp-quote (or muse-file-extension
"")) "\\|"
140 (mapconcat 'identity val
"\\|")
142 (setq muse-ignored-extensions-regexp
143 (if muse-file-extension
144 (concat "\\.\\(" muse-file-extension
"\\)\\'")
147 (add-hook 'muse-update-values-hook
149 (muse-update-ignored-extensions-regexp
150 'muse-ignored-extensions muse-ignored-extensions
)))
152 (defcustom muse-ignored-extensions
'("bz2" "gz" "[Zz]")
153 "A list of extensions to omit from the ending of a Muse page name.
156 Don't put a period at the beginning of each extension unless you
157 understand that it is part of a regexp."
158 :type
'(repeat (regexp :tag
"Extension"))
159 :set
'muse-update-ignored-extensions-regexp
162 (defun muse-update-file-extension-after-init ()
163 ;; This is short, but it has to be a function, otherwise Emacs21
164 ;; does not load it properly when running after-init-hook
165 (muse-update-file-extension 'muse-file-extension muse-file-extension
))
167 ;; Once the user's init file has been processed, determine whether
168 ;; they want a file extension
169 (add-hook 'after-init-hook
'muse-update-file-extension-after-init
)
173 (require 'muse-protocols
)
177 (defsubst muse-delete-file-if-exists
(file)
178 (when (file-exists-p file
)
180 (message "Removed %s" file
)))
182 (defsubst muse-time-less-p
(t1 t2
)
183 "Say whether time T1 is less than time T2."
184 (or (< (car t1
) (car t2
))
185 (and (= (car t1
) (car t2
))
186 (< (nth 1 t1
) (nth 1 t2
)))))
189 (defvar muse-publishing-current-file nil
))
191 (defun muse-current-file ()
192 "Return the name of the currently visited or published file."
193 (or (and (boundp 'muse-publishing-current-file
)
194 muse-publishing-current-file
)
196 (concat default-directory
(buffer-name))))
198 (defun muse-page-name (&optional name
)
199 "Return the canonical form of a Muse page name.
200 All this means is that certain extensions, like .gz, are removed."
202 (unless (and name
(not (string= name
"")))
203 (setq name
(muse-current-file)))
205 (let ((page (file-name-nondirectory name
)))
206 (if (and muse-ignored-extensions-regexp
207 (string-match muse-ignored-extensions-regexp page
))
208 (replace-match "" t t page
)
211 (defun muse-display-warning (message)
212 "Display the given MESSAGE as a warning."
213 (if (fboundp 'display-warning
)
214 (display-warning 'muse message
215 (if (featurep 'xemacs
)
218 (let ((buf (get-buffer-create "*Muse warnings*")))
219 (with-current-buffer buf
220 (goto-char (point-max))
221 (insert "Warning (muse): " message
)
227 (defun muse-eval-lisp (form)
228 "Evaluate the given form and return the result as a string."
232 (let ((object (eval (read form
))))
234 ((stringp object
) object
)
236 (not (eq object nil
)))
237 (let ((string (pp-to-string object
)))
238 (substring string
0 (1- (length string
)))))
240 (number-to-string object
))
243 (pp-to-string object
))))
245 (muse-display-warning (format "%s: Error evaluating %s: %s"
246 (muse-page-name) form err
))
247 "; INVALID LISP CODE"))))
249 (defmacro muse-with-temp-buffer
(&rest body
)
250 "Create a temporary buffer, and evaluate BODY there like `progn'.
251 See also `with-temp-file' and `with-output-to-string'.
253 Unlike `with-temp-buffer', this will never attempt to save the temp buffer.
254 It is meant to be used along with `insert-file-contents'.
256 Additionally, if `debug-on-error' is set to t, keep the buffer
257 around for debugging purposes rather than removing it."
258 (let ((temp-buffer (make-symbol "temp-buffer")))
259 `(let ((,temp-buffer
(generate-new-buffer " *muse-temp*")))
262 (with-current-buffer ,temp-buffer
265 (with-current-buffer ,temp-buffer
268 (if (and (boundp 'muse-batch-publishing-p
)
269 muse-batch-publishing-p
)
271 (message "%s: Error occured: %s"
272 (muse-page-name) err
)
274 (muse-display-warning
275 (format (concat "An error occurred while publishing"
276 " %s: %s\n\nSet debug-on-error to"
277 " `t' if you would like a backtrace.")
278 (muse-page-name) err
))))))
279 (when (buffer-live-p ,temp-buffer
)
280 (with-current-buffer ,temp-buffer
281 (set-buffer-modified-p nil
))
282 (unless debug-on-error
(kill-buffer ,temp-buffer
)))))))
284 (put 'muse-with-temp-buffer
'lisp-indent-function
0)
285 (put 'muse-with-temp-buffer
'edebug-form-spec
'(body))
287 (defun muse-collect-alist (list element
&optional test
)
288 "Collect items from LIST whose car is equal to ELEMENT.
289 If TEST is specified, use it to compare ELEMENT."
290 (unless test
(setq test
'equal
))
293 (when (funcall test element
(car item
))
294 (setq items
(cons item items
))))
297 (defmacro muse-sort-with-closure
(list predicate closure
)
298 "Sort LIST, stably, comparing elements using PREDICATE.
299 Returns the sorted list. LIST is modified by side effects.
300 PREDICATE is called with two elements of list and CLOSURE.
301 PREDICATE should return non-nil if the first element should sort
303 `(sort ,list
(lambda (a b
) (funcall ,predicate a b
,closure
))))
305 (put 'muse-sort-with-closure
'lisp-indent-function
0)
306 (put 'muse-sort-with-closure
'edebug-form-spec
'(form function-form form
))
308 (defun muse-sort-by-rating (rated-list &optional test
)
309 "Sort RATED-LIST according to the rating of each element.
310 The rating is stripped out in the returned list.
311 Default sorting is highest-first.
313 If TEST if specified, use it to sort the list."
314 (unless test
(setq test
'>))
315 (mapcar (function cdr
)
316 (muse-sort-with-closure
318 (lambda (a b closure
)
319 (let ((na (numberp (car a
)))
320 (nb (numberp (car b
))))
321 (cond ((and na nb
) (funcall closure
(car a
) (car b
)))
326 (defun muse-escape-specials-in-string (specials string
&optional reverse
)
327 "Apply the transformations in SPECIALS to STRING.
329 The transforms should form a fully reversible and non-ambiguous
330 syntax when STRING is parsed from left to right.
332 If REVERSE is specified, reverse an already-escaped string."
333 (let ((rules (mapcar (lambda (rule)
334 (cons (regexp-quote (if reverse
337 (if reverse
(car rule
) (cdr rule
))))
341 (goto-char (point-min))
344 (unless (catch 'found
346 (when (looking-at (car rule
))
347 (replace-match (cdr rule
) t t
)
352 (defun muse-trim-whitespace (string)
353 "Return a version of STRING with no initial nor trailing whitespace."
354 (muse-replace-regexp-in-string
355 (concat "\\`[" muse-regexp-blank
"]+\\|[" muse-regexp-blank
"]+\\'")
358 (defun muse-path-sans-extension (path)
359 "Return PATH sans final \"extension\".
361 The extension, in a file name, is the part that follows the last `.',
362 except that a leading `.', if any, doesn't count.
364 This differs from `file-name-sans-extension' in that it will
365 never modify the directory part of the path."
366 (concat (file-name-directory path
)
367 (file-name-nondirectory (file-name-sans-extension path
))))
369 ;; The following code was extracted from cl
371 (defun muse-const-expr-p (x)
373 (or (eq (car x
) 'quote
)
374 (and (memq (car x
) '(function function
*))
375 (or (symbolp (nth 1 x
))
376 (and (eq (and (consp (nth 1 x
))
377 (car (nth 1 x
))) 'lambda
) 'func
)))))
378 ((symbolp x
) (and (memq x
'(nil t
)) t
))
381 (put 'muse-assertion-failed
'error-conditions
'(error))
382 (put 'muse-assertion-failed
'error-message
"Assertion failed")
384 (defun muse-list* (arg &rest rest
)
385 "Return a new list with specified args as elements, cons'd to last arg.
386 Thus, `(list* A B C D)' is equivalent to `(nconc (list A B C) D)', or to
387 `(cons A (cons B (cons C D)))'."
388 (cond ((not rest
) arg
)
389 ((not (cdr rest
)) (cons arg
(car rest
)))
390 (t (let* ((n (length rest
))
391 (copy (copy-sequence rest
))
392 (last (nthcdr (- n
2) copy
)))
393 (setcdr last
(car (cdr last
)))
396 (defmacro muse-assert
(form &optional show-args string
&rest args
)
397 "Verify that FORM returns non-nil; signal an error if not.
398 Second arg SHOW-ARGS means to include arguments of FORM in message.
399 Other args STRING and ARGS... are arguments to be passed to `error'.
400 They are not evaluated unless the assertion fails. If STRING is
401 omitted, a default message listing FORM itself is used."
407 (and (not (muse-const-expr-p x
)) x
)))
412 (muse-list* 'error string
(append sargs args
))
413 (list 'signal
'(quote muse-assertion-failed
)
414 (muse-list* 'list
(list 'quote form
) sargs
))))
417 ;; Compatibility functions
419 (if (fboundp 'looking-back
)
420 (defalias 'muse-looking-back
'looking-back
)
421 (defun muse-looking-back (regexp &optional limit
&rest ignored
)
423 (re-search-backward (concat "\\(?:" regexp
"\\)\\=") limit t
))))
425 (if (fboundp 'line-end-position
)
426 (defalias 'muse-line-end-position
'line-end-position
)
427 (defun muse-line-end-position (&optional n
)
428 (save-excursion (end-of-line n
) (point))))
430 (if (fboundp 'line-beginning-position
)
431 (defalias 'muse-line-beginning-position
'line-beginning-position
)
432 (defun muse-line-beginning-position (&optional n
)
433 (save-excursion (beginning-of-line n
) (point))))
436 (if (fboundp 'match-string-no-properties
)
437 (defalias 'muse-match-string-no-properties
'match-string-no-properties
)
438 (defun muse-match-string-no-properties (num &optional string
)
439 (match-string num string
))))
441 (defun muse-replace-regexp-in-string (regexp replacement text
&optional fixedcase literal
)
442 "Replace REGEXP with REPLACEMENT in TEXT.
444 Return a new string containing the replacements.
446 If fourth arg FIXEDCASE is non-nil, do not alter case of replacement text.
447 If fifth arg LITERAL is non-nil, insert REPLACEMENT literally."
449 ((fboundp 'replace-in-string
)
450 (replace-in-string text regexp replacement literal
))
451 ((fboundp 'replace-regexp-in-string
)
452 (replace-regexp-in-string regexp replacement text fixedcase literal
))
453 (t (let ((repl-len (length replacement
))
455 (unless (string= regexp
"")
457 (while (setq start
(string-match regexp text start
))
458 (setq start
(+ start repl-len
)
459 text
(replace-match replacement fixedcase literal
463 (if (fboundp 'add-to-invisibility-spec
)
464 (defalias 'muse-add-to-invisibility-spec
'add-to-invisibility-spec
)
465 (defun muse-add-to-invisibility-spec (element)
466 "Add ELEMENT to `buffer-invisibility-spec'.
467 See documentation for `buffer-invisibility-spec' for the kind of elements
469 (if (eq buffer-invisibility-spec t
)
470 (setq buffer-invisibility-spec
(list t
)))
471 (setq buffer-invisibility-spec
472 (cons element buffer-invisibility-spec
))))
474 (if (fboundp 'read-directory-name
)
475 (defalias 'muse-read-directory-name
'read-directory-name
)
476 (defun muse-read-directory-name (prompt &optional dir default-dirname mustmatch initial
)
477 "Read directory name - see `read-file-name' for details."
479 (setq dir default-directory
))
480 (read-file-name prompt dir
(or default-dirname
481 (if initial
(expand-file-name initial dir
)
485 (defun muse-file-remote-p (file)
486 "Test whether FILE specifies a location on a remote system.
487 Return non-nil if the location is indeed remote.
489 For example, the filename \"/user@host:/foo\" specifies a location
490 on the system \"/user@host:\"."
491 (cond ((fboundp 'file-remote-p
)
492 (file-remote-p file
))
493 ((fboundp 'tramp-handle-file-remote-p
)
494 (tramp-handle-file-remote-p file
))
495 ((and (boundp 'ange-ftp-name-format
)
496 (string-match (car ange-ftp-name-format
) file
))
500 ;; Set face globally in a predictable fashion
501 (defun muse-copy-face (old new
)
502 "Copy face OLD to NEW."
503 (if (featurep 'xemacs
)
504 (copy-face old new
'all
)
505 (copy-face old new
)))
507 ;; Widget compatibility functions
509 (defun muse-widget-type-value-create (widget)
510 "Convert and instantiate the value of the :type attribute of WIDGET.
511 Store the newly created widget in the :children attribute.
513 The value of the :type attribute should be an unconverted widget type."
514 (let ((value (widget-get widget
:value
))
515 (type (widget-get widget
:type
)))
516 (widget-put widget
:children
517 (list (widget-create-child-value widget
518 (widget-convert type
)
521 (defun muse-widget-child-value-get (widget)
522 "Get the value of the first member of :children in WIDGET."
523 (widget-value (car (widget-get widget
:children
))))
525 (defun muse-widget-type-match (widget value
)
526 "Non-nil if the :type value of WIDGET matches VALUE.
528 The value of the :type attribute should be an unconverted widget type."
529 (widget-apply (widget-convert (widget-get widget
:type
)) :match value
))
531 ;; Link-handling functions and variables
533 (defun muse-get-link (&optional target
)
534 "Based on the match data, retrieve the link.
535 Use TARGET to get the string, if it is specified."
536 (muse-match-string-no-properties 1 target
))
538 (defun muse-get-link-desc (&optional target
)
539 "Based on the match data, retrieve the link description.
540 Use TARGET to get the string, if it is specified."
541 (muse-match-string-no-properties 2 target
))
543 (defvar muse-link-specials
547 "Syntax used for escaping and unescaping links.
548 This allows brackets to occur in explicit links as long as you
549 use the standard Muse functions to create them.")
551 (defun muse-link-escape (text)
552 "Escape characters in TEXT that conflict with the explicit link
555 (muse-escape-specials-in-string muse-link-specials text
)))
557 (defun muse-link-unescape (text)
558 "Un-escape characters in TEXT that conflict with the explicit
561 (muse-escape-specials-in-string muse-link-specials text t
)))
563 (defun muse-handle-url (&optional string
)
564 "If STRING or point has a URL, match and return it."
565 (if (if string
(string-match muse-url-regexp string
)
566 (looking-at muse-url-regexp
))
567 (match-string 0 string
)))
569 (defcustom muse-implicit-link-functions
'(muse-handle-url)
570 "A list of functions to handle an implicit link.
571 An implicit link is one that is not surrounded by brackets.
573 By default, Muse handles URLs only.
574 If you want to handle WikiWords, load muse-wiki.el."
576 :options
'(muse-handle-url)
579 (defun muse-handle-implicit-link (&optional link
)
580 "Handle implicit links. If LINK is not specified, look at point.
581 An implicit link is one that is not surrounded by brackets.
582 By default, Muse handles URLs only.
583 If you want to handle WikiWords, load muse-wiki.el.
585 This function modifies the match data so that match 0 is the
588 The match data is restored after each unsuccessful handler
589 function call. If LINK is specified, only restore at very end.
591 This behavior is needed because the part of the buffer that
592 `muse-implicit-link-regexp' matches must be narrowed to the part
593 that is an accepted link."
594 (let ((funcs muse-implicit-link-functions
)
596 (data (match-data t
)))
598 (setq res
(funcall (car funcs
) link
))
601 (unless link
(set-match-data data
))
602 (setq funcs
(cdr funcs
))))
603 (when link
(set-match-data data
))
606 (defcustom muse-explicit-link-functions nil
607 "A list of functions to handle an explicit link.
608 An explicit link is one [[like][this]] or [[this]]."
612 (defun muse-handle-explicit-link (&optional link
)
613 "Handle explicit links. If LINK is not specified, look at point.
614 An explicit link is one that looks [[like][this]] or [[this]].
616 The match data is preserved. If no handlers are able to process
617 LINK, return LINK (if specified) or the 1st match string. If
618 LINK is not specified, it is assumed that Muse has matched
619 against `muse-explicit-link-regexp' before calling this
621 (let ((funcs muse-explicit-link-functions
)
625 (setq res
(funcall (car funcs
) link
))
628 (setq funcs
(cdr funcs
)))))
632 (or link
(muse-get-link))))))
634 ;; Movement functions
636 (defun muse-list-item-type (str)
637 "Determine the type of list given STR.
638 Returns either 'ul, 'ol, 'dl-term, or 'dl-entry."
639 (cond ((or (string= str
"")
642 ((and (= (aref str
0) ?\
)
646 (string-match (concat "\\`[" muse-regexp-blank
"][0-9]+\\.") str
))
649 (not (string-match (concat "\\`[" muse-regexp-blank
"]*::") str
)))
650 ;; if str is not any kind of list, it will be interpreted as
655 (defun muse-list-item-critical-point (&optional offset
)
656 "Figure out where the important markup character for the
657 currently-matched list item is.
659 If OFFSET is specified, it is the number of groupings outside of
660 the contents of `muse-list-item-regexp'."
661 (unless offset
(setq offset
0))
662 (if (match-end (+ offset
2))
663 ;; at a definition list
664 (match-end (+ offset
2))
665 ;; at a different kind of list
666 (match-beginning (+ offset
1))))
668 (defun muse-forward-paragraph (&optional pattern
)
669 "Move forward safely by one paragraph, or according to PATTERN."
670 (when (get-text-property (point) 'end-list
)
671 (goto-char (next-single-property-change (point) 'end-list
)))
672 (setq pattern
(if pattern
673 (concat "^\\(?:" pattern
"\\|\n\\|\\'\\)")
674 "^\\s-*\\(\n\\|\\'\\)"))
675 (let ((next-list-end (or (next-single-property-change (point) 'end-list
)
678 (if (re-search-forward pattern nil t
)
679 (goto-char (match-beginning 0))
680 (goto-char (point-max)))
681 (when (> (point) next-list-end
)
682 (goto-char next-list-end
))))
684 (defun muse-forward-list-item-1 (type empty-line indented-line
)
685 "Determine whether a nested list item is after point."
686 (if (match-beginning 1)
687 ;; if we are given a dl entry, skip past everything on the same
688 ;; level, except for other dl entries
689 (and (eq type
'dl-entry
)
690 (not (eq (char-after (match-beginning 2)) ?\
:)))
691 ;; blank line encountered with no list item on the same
696 (and (looking-at indented-line
)
697 (not (looking-at empty-line
))))
698 ;; found that this blank line is followed by some
699 ;; indentation, plus other text, so we'll keep
705 (defun muse-forward-list-item (type indent
&optional no-skip-nested
)
706 "Move forward to the next item of TYPE.
707 Return non-nil if successful, nil otherwise.
708 The beginning indentation is given by INDENT.
710 If NO-SKIP-NESTED is non-nil, do not skip past nested items.
711 Note that if you desire this behavior, you will also need to
712 provide a very liberal INDENT value, such as
713 \(concat \"[\" muse-regexp-blank \"]*\")."
714 (let* ((list-item (format muse-list-item-regexp indent
))
715 (empty-line (concat "^[" muse-regexp-blank
"]*\n"))
716 (indented-line (concat "^" indent
"[" muse-regexp-blank
"]"))
717 (list-pattern (concat "\\(?:" empty-line
"\\)?"
718 "\\(" list-item
"\\)")))
720 (muse-forward-paragraph list-pattern
)
721 ;; make sure we don't go past boundary
722 (and (not (or (get-text-property (point) 'end-list
)
723 (>= (point) (point-max))))
724 ;; move past markup that is part of another construct
725 (or (and (match-beginning 1)
726 (or (get-text-property
727 (muse-list-item-critical-point 1) 'muse-link
)
729 (muse-list-item-critical-point 1) 'face
)))
731 (and (not no-skip-nested
)
732 (muse-forward-list-item-1 type empty-line
734 (cond ((or (get-text-property (point) 'end-list
)
735 (>= (point) (point-max)))
736 ;; at a list boundary, so stop
738 ((and (match-string 2)
739 (eq type
(muse-list-item-type (match-string 2))))
740 ;; same type, so indicate that there are more items to be
742 (goto-char (match-beginning 1)))
744 (when (match-beginning 1)
745 (goto-char (match-beginning 1)))
746 ;; move to just before foreign list item markup
749 (defun muse-goto-tag-end (tag nested
)
750 "Move forward past the end of TAG.
752 If NESTED is non-nil, look for other instances of this tag that
753 may be nested inside of this tag, and skip past them."
755 (search-forward (concat "</" tag
">") nil t
)
757 (tag-regexp (concat "\\(<\\(/?\\)" tag
">\\)"))
759 (while (and (> nesting
0)
760 (setq match-found
(re-search-forward tag-regexp nil t
)))
761 (if (string-equal (match-string 2) "/")
762 (setq nesting
(1- nesting
))
763 (setq nesting
(1+ nesting
))))
766 ;;; muse.el ends here