[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hi-lock-write-interactive-patterns inserts trailing whitespace
From: |
Alexander Klimov |
Subject: |
hi-lock-write-interactive-patterns inserts trailing whitespace |
Date: |
Mon, 21 Nov 2005 14:44:34 +0200 (IST) |
Hi.
I start to use `highlight trailing whitespace' and now it become
irritating that hi-lock-write-interactive-patterns inserts trailing
whitespaces.
The fix is trivial:
================================================================================
*** hi-lock.el~ Mon Nov 21 14:20:33 2005
--- hi-lock.el Mon Nov 21 14:21:33 2005
***************
*** 469,473 ****
(mapcar
(lambda (pattern)
! (insert (format "%s (%s) %s\n"
prefix (prin1-to-string pattern) (or comment-end ""))))
hi-lock-interactive-patterns)))
--- 469,473 ----
(mapcar
(lambda (pattern)
! (insert (format "%s (%s)%s\n"
prefix (prin1-to-string pattern) (or comment-end ""))))
hi-lock-interactive-patterns)))
================================================================================
It looks like comment-end has a space almost everywhere:
lisp/progmodes/cc-cmds.el:3373:
(setq comment-start "/* " comment-end " */"))
./lisp/progmodes/ld-script.el:134:
(set (make-local-variable 'comment-end) " */")
./lisp/progmodes/modula2.el:159:
(setq comment-end " *)")
./lisp/progmodes/simula.el:389:
(setq comment-end " ;")
./lisp/textmodes/sgml-mode.el:440:
(set (make-local-variable 'comment-end) " -->")
and this is consistent with its definition:
String to insert to end a new comment
OTOH I found two places where comment-end does not start with a
space:
./lisp/generic-x.el:1501:
comment-end "*/"
./lisp/progmodes/pascal.el:381:
(setq comment-end "}")
I guess it is a good idea to make them consistent: add a space to
generic-x and pascal and state in comment-end's docs that space should
be used if it is what the user wants.
Alternatively, we can fix subj in a more complex way:
===============================================================================
*** hi-lock.el~ Mon Nov 21 14:20:33 2005
--- hi-lock.el Mon Nov 21 14:28:31 2005
***************
*** 469,474 ****
(mapcar
(lambda (pattern)
! (insert (format "%s (%s) %s\n"
! prefix (prin1-to-string pattern) (or comment-end ""))))
hi-lock-interactive-patterns)))
--- 469,480 ----
(mapcar
(lambda (pattern)
! (insert (format "%s (%s)%s\n"
! prefix
! (prin1-to-string pattern)
! (if (or (equal comment-end "")
! (string-match "^[ \t]" comment-end))
! comment-end
! (concat " " comment-end))
! )))
hi-lock-interactive-patterns)))
===============================================================================
The double space in the beginning is less annoying, but can also be
fixed for consistency:
===============================================================================
*** hi-lock.el~ Mon Nov 21 14:20:33 2005
--- hi-lock.el Mon Nov 21 14:31:51 2005
***************
*** 462,466 ****
be found in variable `hi-lock-interactive-patterns'."
(interactive)
! (let ((prefix (format "%s %s:" (or comment-start "") "Hi-lock")))
(when (> (+ (point) (length prefix)) hi-lock-file-patterns-range)
(beep)
--- 462,466 ----
be found in variable `hi-lock-interactive-patterns'."
(interactive)
! (let ((prefix (format "%s%s:" (or comment-start "") "Hi-lock")))
(when (> (+ (point) (length prefix)) hi-lock-file-patterns-range)
(beep)
===============================================================================
--
Regards,
ASK
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- hi-lock-write-interactive-patterns inserts trailing whitespace,
Alexander Klimov <=