~ubuntu-branches/ubuntu/oneiric/muse-el/oneiric

« back to all changes in this revision

Viewing changes to lisp/muse-wiki.el

  • Committer: Bazaar Package Importer
  • Author(s): Michael W. Olson (GNU address)
  • Date: 2008-01-09 15:51:46 UTC
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20080109155146-vkc4ohnzv96spdpm
Tags: upstream-3.11
ImportĀ upstreamĀ versionĀ 3.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 
10
10
;; Emacs Muse is free software; you can redistribute it and/or modify
11
11
;; it under the terms of the GNU General Public License as published
12
 
;; by the Free Software Foundation; either version 2, or (at your
 
12
;; by the Free Software Foundation; either version 3, or (at your
13
13
;; option) any later version.
14
14
 
15
15
;; Emacs Muse is distributed in the hope that it will be useful, but
67
67
  "Regexp used to match the files in the current project.
68
68
 
69
69
This is set by `muse-wiki-update-project-file-regexp' automatically
70
 
when `muse-wiki-martch-all-project-files' is non-nil.")
 
70
when `muse-wiki-match-all-project-files' is non-nil.")
71
71
(make-variable-buffer-local 'muse-wiki-project-file-regexp)
72
72
 
73
73
(defun muse-wiki-update-project-file-regexp ()
117
117
  :type 'boolean
118
118
  :group 'muse-wiki)
119
119
 
120
 
(defvar muse-wiki-interwiki-regexp ""
 
120
(defvar muse-wiki-interwiki-regexp nil
121
121
  "Regexp that matches all interwiki links.
122
122
 
123
123
This is automatically generated by setting `muse-wiki-interwiki-alist'.
157
157
(defun muse-wiki-update-interwiki-regexp ()
158
158
  "Update the value of `muse-wiki-interwiki-regexp' based on
159
159
`muse-wiki-interwiki-alist' and `muse-project-alist'."
160
 
  (when muse-project-alist
 
160
  (if (null muse-project-alist)
 
161
      (setq muse-wiki-interwiki-regexp nil)
161
162
    (setq muse-wiki-interwiki-regexp
162
163
          (concat "\\<\\(" (regexp-opt (mapcar #'car muse-project-alist))
163
164
                  (when muse-wiki-interwiki-alist
225
226
 
226
227
If PAGE is not specified, use the value of :default in PROJECT.
227
228
 
228
 
If PROJECT is not specified, default to first project of
 
229
If PROJECT is not specified, default to the current project.  If
 
230
no project is current, use the first project of
229
231
`muse-projects-alist'.
230
232
 
231
233
Note that PAGE can have several output directories.  If this is
235
237
use the first style we find."
236
238
  (setq project (or (and project
237
239
                         (muse-project project))
 
240
                    (muse-project)
238
241
                    (car muse-project-alist))
239
242
        page (or page (muse-get-keyword :default
240
243
                                        (cadr project))))
241
 
  (let* ((page-path (muse-project-page-file page project))
242
 
         (remote-styles (when page-path (muse-project-applicable-styles
243
 
                                         page-path (cddr project))))
 
244
  (let* ((page-path (and muse-project-alist
 
245
                         (muse-project-page-file page project)))
 
246
         (remote-styles (and page-path (muse-project-applicable-styles
 
247
                                        page-path (cddr project))))
244
248
         (local-style (muse-project-current-output-style)))
245
249
    (cond ((and remote-styles local-style muse-publishing-p)
246
250
           (muse-project-resolve-link page local-style remote-styles))
260
264
  "If STRING or point has an interwiki link, resolve it to a filename.
261
265
 
262
266
Match string 0 is set to the link."
263
 
  (when (if string (string-match muse-wiki-interwiki-regexp string)
264
 
          (looking-at muse-wiki-interwiki-regexp))
 
267
  (when (and muse-wiki-interwiki-regexp
 
268
             (if string (string-match muse-wiki-interwiki-regexp string)
 
269
               (looking-at muse-wiki-interwiki-regexp)))
265
270
    (let* ((project (match-string 1 string))
266
271
           (subst (cdr (assoc project muse-wiki-interwiki-alist)))
267
272
           (word (match-string 3 string))
281
286
(defun muse-wiki-handle-explicit-interwiki (&optional string)
282
287
  "If STRING or point has an interwiki link, resolve it to a filename."
283
288
  (let ((right-pos (if string (length string) (match-end 1))))
284
 
    (when (if string (string-match muse-wiki-interwiki-regexp string)
285
 
            (looking-at muse-wiki-interwiki-regexp))
 
289
    (when (and muse-wiki-interwiki-regexp
 
290
               (if string (string-match muse-wiki-interwiki-regexp string)
 
291
                 (save-restriction
 
292
                   (narrow-to-region (point) right-pos)
 
293
                   (looking-at muse-wiki-interwiki-regexp))))
286
294
      (let* ((project (match-string 1 string))
287
295
             (subst (cdr (assoc project muse-wiki-interwiki-alist)))
288
296
             (anchor (and (match-beginning 4)