all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* blink-matching-open does not work for text property parens
@ 2003-08-21 20:50 Martin Stjernholm
  0 siblings, 0 replies; only message in thread
From: Martin Stjernholm @ 2003-08-21 20:50 UTC (permalink / raw)


If a mode implements parens selectively on some characters using the
`syntax-table' text property (with parse-sexp-lookup-properties set to
non-nil) then the standard paren blinking function
`blink-matching-open' won't work correctly. The reason is that it uses
`char-syntax' and `matching-paren' on the character itself, without
regard to the properties it might have in the buffer. This patch fixes
that:


Index: lisp/simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.617
diff -C3 -r1.617 simple.el
*** lisp/simple.el	17 Aug 2003 00:15:53 -0000	1.617
--- lisp/simple.el	21 Aug 2003 20:43:08 -0000
***************
*** 3500,3506 ****
  			   (point)))))
         (let* ((oldpos (point))
  	      (blinkpos)
! 	      (mismatch))
  	 (save-excursion
  	   (save-restriction
  	     (if blink-matching-paren-distance
--- 3500,3507 ----
  			   (point)))))
         (let* ((oldpos (point))
  	      (blinkpos)
! 	      (mismatch)
! 	      matching-paren)
  	 (save-excursion
  	   (save-restriction
  	     (if blink-matching-paren-distance
***************
*** 3514,3525 ****
  		   (setq blinkpos (scan-sexps oldpos -1)))
  	       (error nil)))
  	   (and blinkpos
! 		(/= (char-syntax (char-after blinkpos))
! 		    ?\$)
! 		(setq mismatch
! 		      (or (null (matching-paren (char-after blinkpos)))
  			  (/= (char-after (1- oldpos))
! 			      (matching-paren (char-after blinkpos))))))
  	   (if mismatch (setq blinkpos nil))
  	   (if blinkpos
  	       ;; Don't log messages about paren matching.
--- 3515,3534 ----
  		   (setq blinkpos (scan-sexps oldpos -1)))
  	       (error nil)))
  	   (and blinkpos
! 		(save-excursion
! 		  (goto-char blinkpos)
! 		  (not (looking-at "\\s$")))
! 		(setq matching-paren
! 		      (or (and parse-sexp-lookup-properties
! 			       (let ((prop (get-text-property blinkpos 'syntax-table)))
! 				 (and (consp prop)
! 				      (eq (car prop) 4)
! 				      (cdr prop))))
! 			  (matching-paren (char-after blinkpos)))
! 		      mismatch
! 		      (or (null matching-paren)
  			  (/= (char-after (1- oldpos))
! 			      matching-paren))))
  	   (if mismatch (setq blinkpos nil))
  	   (if blinkpos
  	       ;; Don't log messages about paren matching.



2003-08-21  Martin Stjernholm  <mast@lysator.liu.se>

	* simple.el (blink-matching-open): Work correctly on chars that
	are designated as parens through the syntax-table text property.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-21 20:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-21 20:50 blink-matching-open does not work for text property parens Martin Stjernholm

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.