GNU bug report logs - #13467
24.3.50; Problem with `advice' show-paren-function

Previous Next

Package: emacs;

Reported by: nyc4bos <at> aol.com

Date: Wed, 16 Jan 2013 22:24:02 UTC

Severity: normal

Tags: notabug

Found in version 24.3.50

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13467 in the body.
You can then email your comments to 13467 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13467; Package emacs. (Wed, 16 Jan 2013 22:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to nyc4bos <at> aol.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 16 Jan 2013 22:24:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: nyc4bos <at> aol.com
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; Problem with `advice' show-paren-function
Date: Wed, 16 Jan 2013 17:22:56 -0500
Hi,

While trying to send an email message ^C^C `(message-send-and-exit)',
I got the following error message in the echo area:

Error in timer: (wrong-type-argument characterp nil)

I was not able to send the message and could only abort (^G).

I then got a backtrace which I have included (below).

I suspect this is because of the changes to `advice'.

Here is 'advice' function that I am using:

(defadvice show-paren-function (after show-matching-paren-offscreen
                                      activate)
  "If the matching paren is offscreen, show the matching line in the
echo area. Has no effect if the character before point is not of
the syntax class ')'."
  (interactive)
  (let ((matching-text nil))
    ;; Only call `blink-matching-open' if the character before point
    ;; is a close parentheses type character. Otherwise, there's not
    ;; really any point, and `blink-matching-open' would just echo
    ;; "Mismatched parentheses", which gets really annoying.
    (if (char-equal (char-syntax (char-before (point))) ?\))
        (setq matching-text (blink-matching-open)))
    (if (not (null matching-text))
        (message matching-text))))

Thanks.

Debugger entered--Lisp error: (wrong-type-argument characterp nil)
  char-syntax(nil)
  (char-equal (char-syntax (char-before (point))) 41)
  (if (char-equal (char-syntax (char-before (point))) 41) (setq matching-text (blink-matching-open)))
  (let ((matching-text nil)) (if (char-equal (char-syntax (char-before (point))) 41) (setq matching-text (blink-matching-open))) (if (not (null matching-text)) (message matching-text)))
  (let (ad-return-value) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function))) (let ((matching-text nil)) (if (char-equal (char-syntax (char-before (point))) 41) (setq matching-text (blink-matching-open))) (if (not (null matching-text)) (message matching-text))) ad-return-value)
  ad-Advice-show-paren-function(#[nil
  "\203\336`\306\307`S!!\310=\203





In GNU Emacs 24.3.50.1 (i386-mingw-nt6.1.7601)
 of 2013-01-15 on ODIEONE
Bzr revision: 111532 dmantipov <at> yandex.ru-20130115101431-o6w1qeqwqcmyxmi9
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -IC:/Devel/emacs/build/include --ldflags -LC:/Devel/emacs/build/lib'

Important settings:
  value of $LANG: en_US
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <menu-bar> <help-menu> 
<send-emacs-bug-report>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 ls-lisp w32-common-fns disp-table w32-win
w32-vars tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer button faces cus-face macroexp files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process w32notify w32
multi-tty emacs)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13467; Package emacs. (Wed, 16 Jan 2013 22:41:02 GMT) Full text and rfc822 format available.

Message #8 received at 13467 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: nyc4bos <at> aol.com
Cc: 13467 <at> debbugs.gnu.org
Subject: Re: bug#13467: 24.3.50; Problem with `advice' show-paren-function
Date: Wed, 16 Jan 2013 17:39:33 -0500
nyc4bos <at> aol.com wrote:

>     (if (char-equal (char-syntax (char-before (point))) ?\))

What do you expect this do if called eg at point-min?
Maybe fail with wrong-type-argument characterp nil?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13467; Package emacs. (Wed, 16 Jan 2013 22:48:01 GMT) Full text and rfc822 format available.

Message #11 received at 13467 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Glenn Morris'" <rgm <at> gnu.org>, <nyc4bos <at> aol.com>
Cc: 13467 <at> debbugs.gnu.org
Subject: RE: bug#13467: 24.3.50; Problem with `advice' show-paren-function
Date: Wed, 16 Jan 2013 14:46:39 -0800
> >     (if (char-equal (char-syntax (char-before (point))) ?\))
> 
> What do you expect this do if called eg at point-min?
> Maybe fail with wrong-type-argument characterp nil?

E.g.,

(let ((matching-text nil)
      (cb            (char-before (point))))
  (when (and cb  (char-equal (char-syntax cb) ?\) ))
    (setq matching-text  (blink-matching-open)))
  (when matching-text (message matching-text)))





bug closed, send any further explanations to 13467 <at> debbugs.gnu.org and nyc4bos <at> aol.com Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 16 Jan 2013 22:49:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13467; Package emacs. (Wed, 16 Jan 2013 23:39:02 GMT) Full text and rfc822 format available.

Message #16 received at 13467 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 'Glenn Morris' <rgm <at> gnu.org>, nyc4bos <at> aol.com, 13467 <at> debbugs.gnu.org
Subject: Re: bug#13467: 24.3.50; Problem with `advice' show-paren-function
Date: Wed, 16 Jan 2013 18:37:58 -0500
> (let ((matching-text nil)
>       (cb            (char-before (point))))
>   (when (and cb  (char-equal (char-syntax cb) ?\) ))
>     (setq matching-text  (blink-matching-open)))
>   (when matching-text (message matching-text)))

Aka

   (let* ((cb (char-before (point)))
          (matching-text
           (when (and cb  (char-equal (char-syntax cb) ?\) ))
             (blink-matching-open))))
     (when matching-text (message matching-text)))


-- Stefan "always try to give the right value right away"




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13467; Package emacs. (Thu, 17 Jan 2013 00:06:01 GMT) Full text and rfc822 format available.

Message #19 received at 13467 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 'Glenn Morris' <rgm <at> gnu.org>, nyc4bos <at> aol.com, 13467 <at> debbugs.gnu.org
Subject: RE: bug#13467: 24.3.50; Problem with `advice' show-paren-function
Date: Wed, 16 Jan 2013 16:04:45 -0800
> > (let ((matching-text nil)
> >       (cb            (char-before (point))))
> >   (when (and cb  (char-equal (char-syntax cb) ?\) ))
> >     (setq matching-text  (blink-matching-open)))
> >   (when matching-text (message matching-text)))
> 
> Aka
> 
>    (let* ((cb (char-before (point)))
>           (matching-text
>            (when (and cb  (char-equal (char-syntax cb) ?\) ))
>              (blink-matching-open))))
>      (when matching-text (message matching-text)))
>
> -- Stefan "always try to give the right value right away"

Yes.  Aka:

(let* ((cb (char-before (point)))
       (matching-text (and cb
                           (char-equal (char-syntax cb) ?\) )
                           (blink-matching-open))))
  (when matching-text (message matching-text)))

-- Drew "use `and' for value; use `when' for effect",
   who tried to keep things close to the OP code, to start





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 14 Feb 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 133 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.