paren.el enhancement: paren-backwards-message

paren.el enhancement: paren-backwards-message

Post by Jonathan Edward » Sun, 15 Sep 1996 04:00:00

Following a suggestion in paren.el, I have added a feature that
changes the message displayed in the minibuffer when a matching paren
is off-screen. If the buffer-local variable paren-backwards-message is
non-nil then the message will show the non-blank line PRECEDING the
opening brace. This is more useful when you use a C style of open
braces on new lines.

If you have already loaded paren.el, this code in your .emacs will
alter its behavior.

;; Determines the message displayed when a matching paren is off-screen.
;; Message displays text from beginning of line to paren.
;; If there is none, and if paren-backwards-message is nil, then the text from
;; the paren to the end of next non-blank line is displayed.
;; If paren-backwards-message is non-nil, then the text displayed is from the
;; previous non-blank line to the paren.

 (defvar paren-backwards-message nil))

(defun paren-describe-match (pos mismatch)  
  (or (window-minibuffer-p (selected-window))
        (goto-char pos)
        (message "%s %s"
                 (if mismatch "MISMATCH:" "Matches")
                 ;; if there's stuff on this line preceding the paren, then
                 ;; display text from beginning of line to paren.
                 (if (save-excursion
                       (skip-chars-backward " \t")
                       (not (bolp)))
                     (concat (buffer-substring
                              (progn (beginning-of-line) (point))
                              (1+ pos)) "...")
                   (if paren-backwards-message
                       ;; display previous non-blank line to paren
                          (skip-chars-backward "\n \t")
                        (1+ pos))
                     ;; display paren to next non-blank line
                      pos (progn
                            (forward-char 1)
                            (skip-chars-forward "\n \t")


1. paren-backwards-message and Java

Xemacs 21.1, and sumo-tarball of Aug 19.

One probable-bug leads to another while editing a Java:

When a right-curly brace matches a left-curly that is off the
screen I get paren matching text in the minibuffer and the
context FOLLOWING the left-curly.  This should be (for Java) the
context BEFORE the left-curly.  cc-mode.el probably needs the new
variable paren-backwards-message to be set.

By setting paren-backwards-message to 't', I get context before
the left-curly... ALL the context, i.e., everything from the
beginning of the file to the left-curly in question.  Something
is broke.



2. GetActiveObject() return error

3. paren.el enhancements

4. Question of Some CDP Data and Its Meaning

5. (paren-set-mode 'paren)

6. Festfequenzmonitore und Dualhead

7. paren.el patch to customize type

8. Testing definitions

9. please help with paren.el

10. bug in stig-paren.el?

11. A variation of paren.el

12. A bit improved paren.el

13. paren.el broken in 19.34?