emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

`comment-normalize-vars' problem


From: Jesper Harder
Subject: `comment-normalize-vars' problem
Date: Tue, 25 Nov 2003 17:44:55 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

In GNU Emacs 21.3.50.73 (i686-pc-linux-gnu, GTK+ Version 2.0.2)
 of 2003-11-25 on defun.localdomain
configured using `configure '--with-gtk''


Steps to reproduce:

· Select a region in fundamental mode.

· Do `M-x comment-region', and answer the prompt with some string.

· `comment-region' fails with this backtrace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match(nil "- ")
  (if (string-match comment-start-skip s) s (comment-padright comment-start))
  (let ((s ...)) (if (string-match comment-start-skip s) s (comment-padright 
comment-start)))
  (comment-region-internal beg end (let (...) (if ... s ...)) (let (...) (and s 
...)) (if multi (comment-padright comment-continue numarg)) (if multi 
(comment-padleft ... numarg)) block lines (nth 3 style))
  (cond ((consp arg) (uncomment-region beg end)) ((< numarg 0) 
(uncomment-region beg end ...)) (t (setq numarg ...) (comment-region-internal 
beg end ... ... ... ... block lines ...)))
  (let* ((numarg ...) (add comment-add) (style ...) (lines ...) (block ...) 
(multi ...)) (save-excursion (goto-char beg) (skip-chars-forward "  \n
") (beginning-of-line) (setq beg ...) (goto-char end) (skip-chars-backward "    
\n
") (end-of-line) (setq end ...) (if ... ...) (setq lines ...)) (unless (or 
lines ...) (setq block nil)) (cond (... ...) (... ...) (t ... ...)))
  comment-region(1 9 nil)
* call-interactively(comment-region)
  execute-extended-command(nil)
  call-interactively(execute-extended-command)

The problem appears to be that `comment-normalize-vars' skips too
much of the setup if `comment-start' is nil initially.

A possible fix:

diff -c /home/harder/emacs/lisp/newcomment.el.\~1.69.\~ 
/home/harder/emacs/lisp/newcomment.el
*** /home/harder/emacs/lisp/newcomment.el.~1.69.~       Sat Oct 25 00:56:31 2003
--- /home/harder/emacs/lisp/newcomment.el       Tue Nov 25 17:09:22 2003
***************
*** 224,233 ****
  Functions autoloaded from newcomment.el, being entry points, should call
  this function before any other, so the rest of the code can assume that
  the variables are properly set."
!   (if (not comment-start)
!       (unless noerror
!       (set (make-local-variable 'comment-start)
!            (read-string "No comment syntax is defined.  Use: ")))
      ;; comment-use-syntax
      (when (eq comment-use-syntax 'undecided)
        (set (make-local-variable 'comment-use-syntax)
--- 224,233 ----
  Functions autoloaded from newcomment.el, being entry points, should call
  this function before any other, so the rest of the code can assume that
  the variables are properly set."
!   (unless (and (not comment-start) noerror)
!     (unless comment-start
!       (set (make-local-variable 'comment-start)
!          (read-string "No comment syntax is defined.  Use: ")))
      ;; comment-use-syntax
      (when (eq comment-use-syntax 'undecided)
        (set (make-local-variable 'comment-use-syntax)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]