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

Patch: outline-hide-other causes an error if run on the very first character of a buffer

I noticed that outline-hide-other is causing an error if point is on the very first character of a buffer when it's run.
I looked at the existing code for the relevant pieces of advice, and it turns out (or 0 (point-min)) returns 0, not the value of point-min.
So, here is the patch, feel free to improve it:
2 files changed, 9 insertions(+), 2 deletions(-)
lisp/emacspeak-outline.el     | 8 ++++++--
lisp/emacspeak-personality.el | 3 +++

modified   lisp/emacspeak-outline.el
@@ -5,12 +5,16 @@
 (defadvice outline-flag-region (around emacspeak pre act comp)
   "Reflect hide/show via property invisible as wel"
   (let  ((ems--voiceify-overlays  nil)
+         (beg (ad-get-arg 0))
+         (end (ad-get-arg 1))
          (inhibit-read-only t))
+    (if (zerop beg)
+        (setq beg (point-min)))
-       (ad-get-arg 0)
-       (ad-get-arg 1)
+       beg
+       end
        (if (ad-get-arg 2) 'outline nil)))))
modified   lisp/emacspeak-personality.el
@@ -152,6 +152,9 @@ end in object. "
         (beg (or (ad-get-arg 0) (point-min)))
         (end (or (ad-get-arg 1) (point-max)))
         (name (ad-get-arg 2)))
+    ;; outline sometimes sets the first argument to 0, which causes an error because it's not valid
+    (if (zerop beg)
+        (setq beg (point-min)))
     (with-silent-modifications          ; ignores value for now
       (put-text-property beg end name nil))

|All Past Years |Current Year|

If you have questions about this archive or had problems using it, please contact us.

Contact Info Page