all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Highlight opening parentheses in show-paren-mode
@ 2004-04-06  3:57 sand
  2004-04-07 17:46 ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: sand @ 2004-04-06  3:57 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Highlight opening parentheses in show-paren-mode
  2004-04-06  3:57 Highlight opening parentheses in show-paren-mode sand
@ 2004-04-07 17:46 ` Richard Stallman
  2004-04-13 11:35   ` Juri Linkov
  2004-04-13 11:38   ` Juri Linkov
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Stallman @ 2004-04-07 17:46 UTC (permalink / raw)
  Cc: emacs-devel

	When at the beginning of a valid parenthetical expression,
    SHOW-PAREN-FUNCTION in "paren.el" does not highlight the opening
    parenthesis.

The cursor normally highlights the open paren in that case.
It would look bad to put other highlighting on it.
However, it seems you use the bar cursor.  With the bar cursor,
this change would make sense.

Maybe we should test the cursor type there.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Highlight opening parentheses in show-paren-mode
  2004-04-07 17:46 ` Richard Stallman
@ 2004-04-13 11:35   ` Juri Linkov
  2004-04-13 11:38   ` Juri Linkov
  1 sibling, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2004-04-13 11:35 UTC (permalink / raw)
  Cc: sand, emacs-devel

Richard Stallman <rms@gnu.org> writes:
> 	When at the beginning of a valid parenthetical expression,
>     SHOW-PAREN-FUNCTION in "paren.el" does not highlight the opening
>     parenthesis.
>
> The cursor normally highlights the open paren in that case.
> It would look bad to put other highlighting on it.
> However, it seems you use the bar cursor.  With the bar cursor,
> this change would make sense.
>
> Maybe we should test the cursor type there.

I don't think it looks bad even with the box cursor.  Some arguments:

1. The open paren is already highlighted if mismatched.
Nobody complained that it's bad.

2. It looks more correct if both parens are highlighted in the same
color (even if the color of the open paren under the cursor is reversed).

3. Currently, when the cursor is moved from the closeparen to the
openparen (e.g. by backward-sexp), then for a short time before the
overlay gets deleted, the cursor is highlighted in show-paren color,
and then after a small delay the color is switched to the cursor color.
Such blinking looks bad.  It would be better if the open paren was
always highlighted in show-paren color.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Highlight opening parentheses in show-paren-mode
  2004-04-07 17:46 ` Richard Stallman
  2004-04-13 11:35   ` Juri Linkov
@ 2004-04-13 11:38   ` Juri Linkov
  1 sibling, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2004-04-13 11:38 UTC (permalink / raw)
  Cc: emacs-devel

BTW, this reminds me about another problem.  Saving the region into
the kill ring has a delay for showing the position of the mark.  This
delay is always 1 sec and can't be changed.  Instead of introducing a
new variable for this delay it makes sense to use a related variable
blink-matching-delay.  I think users customized this variable for
the delay to show a matching paren would prefer the same value
for the delay to show a mark position:

diff -u -r1.634 simple.el
--- emacs/lisp/simple.el	25 Mar 2004 16:01:37 -0000	1.634
+++ emacs/lisp/simple.el	13 Apr 2004 11:48:09 -0000
@@ -2013,7 +2013,7 @@
 	      ;; Swap point and mark.
 	      (set-marker (mark-marker) (point) (current-buffer))
 	      (goto-char other-end)
-	      (sit-for 1)
+	      (sit-for blink-matching-delay)
 	      ;; Swap back.
 	      (set-marker (mark-marker) other-end (current-buffer))
 	      (goto-char opoint)

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-04-13 11:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-06  3:57 Highlight opening parentheses in show-paren-mode sand
2004-04-07 17:46 ` Richard Stallman
2004-04-13 11:35   ` Juri Linkov
2004-04-13 11:38   ` Juri Linkov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.