emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emacs-wiki-discuss] emacs-wiki, outline-minor-mode, and invisibility


From: Jim Ottaway
Subject: [emacs-wiki-discuss] emacs-wiki, outline-minor-mode, and invisibility
Date: Wed, 26 Jan 2005 10:27:34 +0000
User-agent: Gnus/5.090024 (Oort Gnus v0.24) Emacs/21.2 (gnu/linux)

When using outline-minor-mode with emacs-wiki-mode [without allout
mode] the invisible parts of wiki links (of the [[/foo/bar/baz][foo]]
variety) become visible.

This is because if the invisibility spec for a buffer is t [the
default] then the call (add-to-invisibility-spec '(outline . t)) in
outline-minor-mode makes the invisibility spec '((outline . t)),
losing the general t spec.

One solution is to add a hook to emacs-wiki-mode to make the
invisibility spec '(t).  After starting outline-minor-mode the spec is
then '(t (outline . t)), which works fine.

Another solution is to add an 'emacs-wiki invisibility spec and
activate that; this is probably better because it is more flexible,
it less likely to get messed up by some other minor mode, and it is
the recommended method in the emacs lisp manual.

I have patched emacs-wiki-colors.el to do this. It appears to work,
but there could be some unintended consequences, since I am not very
familiar with the emacs-wiki code.

Regards,

Jim Ottaway

--- orig/emacs-wiki-colors.el
+++ mod/emacs-wiki-colors.el
@@ -415,9 +415,9 @@
         (cond ((= leader 1) (setq face 'italic))
               ((= leader 2) (setq face 'bold))
               ((= leader 3) (setq face 'bold-italic)))
-        (add-text-properties beg e1 '(invisible t intangible t))
+        (add-text-properties beg e1 '(invisible emacs-wiki intangible t))
         (add-text-properties e1 b2 (list 'face face))
-        (add-text-properties b2 e2 '(invisible t intangible t)))
+        (add-text-properties b2 e2 '(invisible emacs-wiki intangible t)))
       (emacs-wiki-multiline-maybe
        beg end
        ;; ensures we only mark the region as multiline if it's
@@ -433,13 +433,13 @@
   (let ((start (- (point) 2))
         (next (1+ (match-beginning 0)))
         end)
-    (when (and (not (get-text-property (point) 'invisible))
+    (when (and (not (eq (get-text-property (point) 'invisible) 'emacs-wiki))
                (setq end (emacs-wiki-highlight-ok-context-p start
                                                             end "_")))
       (add-text-properties start (+ start 1)
-                           '(invisible t intangible t))
+                           '(invisible emacs-wiki intangible t))
       (add-text-properties (+ start 1) (- end 1) '(face underline))
-      (add-text-properties (- end 1) end '(invisible t intangible t)))
+      (add-text-properties (- end 1) end '(invisible emacs-wiki intangible t)))
     (goto-char next)))
 
 (defun emacs-wiki-highlight-verbatim ()
@@ -471,7 +471,7 @@
      ,(function
        (lambda ()
          (add-text-properties (match-beginning 0) (match-end 0)
-                              '(invisible t intangible t)))))
+                              '(invisible emacs-wiki intangible t)))))
 
     ("^#title " ?\# emacs-wiki-highlight-title)
 
@@ -528,6 +528,7 @@
 (defvar font-lock-multiline nil)
 
 (defun emacs-wiki-use-font-lock ()
+  (add-to-invisibility-spec 'emacs-wiki)
   (set (make-local-variable 'font-lock-multiline) 'undecided)
   (set (make-local-variable 'font-lock-defaults)
        `(nil t nil nil 'beginning-of-line
@@ -662,7 +663,7 @@
         (modified-p (buffer-modified-p))
         deactivate-mark)
     (unwind-protect
-        (remove-text-properties
+        (remove-text-properties 
          begin end '(face nil font-lock-multiline nil
                           invisible nil intangible nil display nil))
       (set-buffer-modified-p modified-p))))
@@ -677,7 +678,7 @@
   (append (if face
               (list 'face face 'rear-nonsticky t
                     emacs-wiki-keymap-property emacs-wiki-local-map)
-            (list 'invisible t 'intangible t 'rear-nonsticky t
+            (list 'invisible 'emacs-wiki 'intangible t 'rear-nonsticky t
                   emacs-wiki-keymap-property emacs-wiki-local-map))
           (list 'mouse-face 'highlight
                 'help-echo help-str
@@ -805,7 +806,7 @@
         ;; If we get a valid glyph, use it
         (and (setq glyph (emacs-wiki-make-file-glyph filename))
              (add-text-properties
-              beg end (list 'invisible t
+              beg end (list 'invisible 'emacs-wiki
                             'end-glyph glyph
                             'help-echo (or desc url))))))))
 




-- 
Jim Ottaway




reply via email to

[Prev in Thread] Current Thread [Next in Thread]