bug-gnu-emacs
[Top][All Lists]
Advanced

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

Highlight opening parentheses in show-paren-mode


From: sand
Subject: Highlight opening parentheses in show-paren-mode
Date: Mon, 5 Apr 2004 20:57:30 -0700

In GNU Emacs 21.3.1 (i386-pc-linux-gnu, X toolkit)
 of 2003-10-31 on raven, modified by Debian
configured using `configure  i386-linux --prefix=/usr --sharedstatedir=/var/lib 
--libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info 
--mandir=/usr/share/man --with-pop=yes --without-gif --with-x=yes 
--with-x-toolkit=athena --without-toolkit-scroll-bars'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: nil

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

    When at the beginning of a valid parenthetical expression,
SHOW-PAREN-FUNCTION in "paren.el" does not highlight the opening
parenthesis.  This is inconsistent behavior, since the function *does*
highlight the opening parenthesis for invalid parenthetical
expressions.

    Worse, this behavior displays poorly when the cursor is a bar
(from a frame parameter CURSOR-TYPE of `bar'); we would reasonably
expect those open parentheses to be highlighted, just like ending
parentheses where the bar is immediately after.

    The attached patch removes the test that disables highlighting for
open parentheses.  Alternatively, one could tweak the existing code to
handle bar cursors specially.

Derek Upham
sand@blarg.net

------------------------------ cut here ------------------------------

diff -u /home/sand/paren.el.orig /home/sand/paren.el
--- /home/sand/paren.el.orig    2004-04-04 23:33:00.000000000 -0700
+++ /home/sand/paren.el 2004-04-04 23:47:11.000000000 -0700
@@ -179,25 +179,21 @@
          ;;
          ;; If matching backwards, highlight the closeparen
          ;; before point as well as its matching open.
-         ;; If matching forward, and the openparen is unbalanced,
-         ;; highlight the paren at point to indicate misbalance.
-         ;; Otherwise, turn off any such highlighting.
-         (if (and (= dir 1) (integerp pos))
-             (when (and show-paren-overlay-1
-                        (overlay-buffer show-paren-overlay-1))
-               (delete-overlay show-paren-overlay-1))
-           (let ((from (if (= dir 1)
-                           (point)
-                         (forward-point -1)))
-                 (to (if (= dir 1)
-                         (forward-point 1)
-                       (point))))
-             (if show-paren-overlay-1
-                 (move-overlay show-paren-overlay-1 from to (current-buffer))
-               (setq show-paren-overlay-1 (make-overlay from to)))
-             ;; Always set the overlay face, since it varies.
-             (overlay-put show-paren-overlay-1 'priority show-paren-priority)
-             (overlay-put show-paren-overlay-1 'face face)))
+         ;; If matching forward, highlight the openparen
+          ;; after point as well as its matching close.
+          (let ((from (if (= dir 1)
+                          (point)
+                        (forward-point -1)))
+                (to (if (= dir 1)
+                        (forward-point 1)
+                      (point))))
+            (if show-paren-overlay-1
+                (move-overlay show-paren-overlay-1 from to (current-buffer))
+              (setq show-paren-overlay-1 (make-overlay from to)))
+            ;; Always set the overlay face, since it varies.
+            (overlay-put show-paren-overlay-1 'priority show-paren-priority)
+            (overlay-put show-paren-overlay-1 'face face))
+
          ;;
          ;; Turn on highlighting for the matching paren, if found.
          ;; If it's an unmatched paren, turn off any such highlighting.




reply via email to

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