all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* comment-enter-backward: Wrong type argument: number-or-marker-p, nil
@ 2008-02-21 11:56 Stephen Berman
  2008-04-03 22:27 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Berman @ 2008-02-21 11:56 UTC (permalink / raw)
  To: emacs-devel

In GNU Emacs 23.0.60.7 (i686-pc-linux-gnu, GTK+ Version 2.12.0) of
2008-02-21 on escher I do this:

1. emacs -Q
2. C-x C-f test.c
3. Type this with no following newline: // test
4. C-SPC C-SPC C-a M-;
=> The line gets uncomments but Emacs throws an error
"comment-enter-backward: Wrong type argument: number-or-marker-p, nil"

Note that if the line typed at step 3 is this: /* test */ (also with no
following newline), then after step 4 there is no error.

AFAICT, the reason is as follows.  Since there is no comment-end,
re-search-forward in comment-enter-backward returns nil, so the second
clause of the cond gets evaluated.  But since in the first clause, point
moved to point-min, (car (syntax-after (- (point) 1))) evaluates to nil,
which is a wrong type argument for logand.  So point should be restored:

*** emacs/lisp/newcomment.el.~1.111.~	2008-01-16 10:20:45.000000000 +0100
--- emacs/lisp/newcomment.el	2008-02-21 11:34:01.000000000 +0100
***************
*** 492,501 ****
        ;; comment-end = ""
        (progn (backward-char) (skip-syntax-backward " "))
      (cond
!      ((save-restriction
!         (narrow-to-region (line-beginning-position) (point))
!         (goto-char (point-min))
!         (re-search-forward (concat comment-end-skip "\\'") nil t))
        (goto-char (match-beginning 0)))
       ;; comment-end-skip not found probably because it was not set
       ;; right.  Since \\s> should catch the single-char case, let's
--- 492,502 ----
        ;; comment-end = ""
        (progn (backward-char) (skip-syntax-backward " "))
      (cond
!      ((save-excursion
! 	(save-restriction
! 	  (narrow-to-region (line-beginning-position) (point))
! 	  (goto-char (point-min))
! 	  (re-search-forward (concat comment-end-skip "\\'") nil t)))
        (goto-char (match-beginning 0)))
       ;; comment-end-skip not found probably because it was not set
       ;; right.  Since \\s> should catch the single-char case, let's

If this is right, presumably it should also be fixed in EMACS_22_BASE.

Steve Berman





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

* Re: comment-enter-backward: Wrong type argument: number-or-marker-p, nil
  2008-02-21 11:56 comment-enter-backward: Wrong type argument: number-or-marker-p, nil Stephen Berman
@ 2008-04-03 22:27 ` Stefan Monnier
  2008-04-04 10:19   ` Stephen Berman
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2008-04-03 22:27 UTC (permalink / raw)
  To: Stephen Berman; +Cc: emacs-devel

> 1. emacs -Q
> 2. C-x C-f test.c
> 3. Type this with no following newline: // test
> 4. C-SPC C-SPC C-a M-;
> => The line gets uncomments but Emacs throws an error
> "comment-enter-backward: Wrong type argument: number-or-marker-p, nil"

> Note that if the line typed at step 3 is this: /* test */ (also with no
> following newline), then after step 4 there is no error.

> AFAICT, the reason is as follows.  Since there is no comment-end,
> re-search-forward in comment-enter-backward returns nil, so the second
> clause of the cond gets evaluated.  But since in the first clause, point
> moved to point-min, (car (syntax-after (- (point) 1))) evaluates to nil,
> which is a wrong type argument for logand.  So point should be restored:

Thank you, I've installed it,
And sorry about the delay,


        Stefan




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

* Re: comment-enter-backward: Wrong type argument: number-or-marker-p, nil
  2008-04-03 22:27 ` Stefan Monnier
@ 2008-04-04 10:19   ` Stephen Berman
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Berman @ 2008-04-04 10:19 UTC (permalink / raw)
  To: emacs-devel

On Thu, 03 Apr 2008 18:27:01 -0400 Stefan Monnier <monnier@IRO.UMontreal.CA> wrote:

>> 1. emacs -Q
>> 2. C-x C-f test.c
>> 3. Type this with no following newline: // test
>> 4. C-SPC C-SPC C-a M-;
>> => The line gets uncomments but Emacs throws an error
>> "comment-enter-backward: Wrong type argument: number-or-marker-p, nil"
>
>> Note that if the line typed at step 3 is this: /* test */ (also with no
>> following newline), then after step 4 there is no error.
>
>> AFAICT, the reason is as follows.  Since there is no comment-end,
>> re-search-forward in comment-enter-backward returns nil, so the second
>> clause of the cond gets evaluated.  But since in the first clause, point
>> moved to point-min, (car (syntax-after (- (point) 1))) evaluates to nil,
>> which is a wrong type argument for logand.  So point should be restored:
>
> Thank you, I've installed it,
> And sorry about the delay,
>
>
>         Stefan

Thanks!

Steve Berman





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

end of thread, other threads:[~2008-04-04 10:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-21 11:56 comment-enter-backward: Wrong type argument: number-or-marker-p, nil Stephen Berman
2008-04-03 22:27 ` Stefan Monnier
2008-04-04 10:19   ` Stephen Berman

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.