unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13467: 24.3.50; Problem with `advice' show-paren-function
@ 2013-01-16 22:22 nyc4bos
  2013-01-16 22:39 ` Glenn Morris
  0 siblings, 1 reply; 5+ messages in thread
From: nyc4bos @ 2013-01-16 22:22 UTC (permalink / raw)
  To: 13467

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
  "\b\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@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)





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

* bug#13467: 24.3.50; Problem with `advice' show-paren-function
  2013-01-16 22:22 bug#13467: 24.3.50; Problem with `advice' show-paren-function nyc4bos
@ 2013-01-16 22:39 ` Glenn Morris
  2013-01-16 22:46   ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Glenn Morris @ 2013-01-16 22:39 UTC (permalink / raw)
  To: nyc4bos; +Cc: 13467

nyc4bos@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?





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

* bug#13467: 24.3.50; Problem with `advice' show-paren-function
  2013-01-16 22:39 ` Glenn Morris
@ 2013-01-16 22:46   ` Drew Adams
  2013-01-16 23:37     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2013-01-16 22:46 UTC (permalink / raw)
  To: 'Glenn Morris', nyc4bos; +Cc: 13467

> >     (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)))






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

* bug#13467: 24.3.50; Problem with `advice' show-paren-function
  2013-01-16 22:46   ` Drew Adams
@ 2013-01-16 23:37     ` Stefan Monnier
  2013-01-17  0:04       ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2013-01-16 23:37 UTC (permalink / raw)
  To: Drew Adams; +Cc: nyc4bos, 13467

> (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"





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

* bug#13467: 24.3.50; Problem with `advice' show-paren-function
  2013-01-16 23:37     ` Stefan Monnier
@ 2013-01-17  0:04       ` Drew Adams
  0 siblings, 0 replies; 5+ messages in thread
From: Drew Adams @ 2013-01-17  0:04 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: nyc4bos, 13467

> > (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






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

end of thread, other threads:[~2013-01-17  0:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-16 22:22 bug#13467: 24.3.50; Problem with `advice' show-paren-function nyc4bos
2013-01-16 22:39 ` Glenn Morris
2013-01-16 22:46   ` Drew Adams
2013-01-16 23:37     ` Stefan Monnier
2013-01-17  0:04       ` Drew Adams

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).