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

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

Erase customization fails with comment


From: martin rudalics
Subject: Erase customization fails with comment
Date: Thu, 22 Dec 2005 11:44:08 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Do M-x customize-face RET bold RET

Invoke `State' and select `Add comment'

Invoke `State' and select `Erase Customization'

Gets me:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  set-buffer(nil)
  (save-current-buffer (set-buffer (widget-field-buffer widget)) 
(save-restriction (widen) (get-char-property ... ...)))
  (with-current-buffer (widget-field-buffer widget) (save-restriction (widen) 
(get-char-property ... ...)))
  ...

The problem here is that the associated overlay still exists but has
been disconnected from its buffer.  Hence `widget-field-buffer' returns
nil and `with-current-buffer' fails with buffer nil.  I did not
investigate why the bug occurs only when customizing a face.

The patch below simply checks whether the overlay is still associated
with its buffer.


*** wid-edit.el Thu Dec 15 11:32:48 2005
--- wid-edit.el Thu Dec 22 11:14:22 2005
***************
*** 1202,1223 ****
      ;; or if a special `boundary' field has been added after the widget
      ;; field.
      (if (overlayp overlay)
!       (if (and (not (eq (with-current-buffer
!                             (widget-field-buffer widget)
!                           (save-restriction
!                             ;; `widget-narrow-to-field' can be
!                             ;; active when this function is called
!                             ;; from an change-functions hook. So
!                             ;; temporarily remove field narrowing
!                             ;; before to call `get-char-property'.
!                             (widen)
!                             (get-char-property (overlay-end overlay)
!                                                'field)))
!                         'boundary))
!                (or widget-field-add-space
!                    (null (widget-get widget :size))))
!           (1- (overlay-end overlay))
!         (overlay-end overlay))
        (cdr overlay))))

  (defun widget-field-find (pos)
--- 1202,1225 ----
      ;; or if a special `boundary' field has been added after the widget
      ;; field.
      (if (overlayp overlay)
!         ;; don't proceed if overlay has been removed from buffer
!         (when (overlay-buffer overlay)
!           (if (and (not (eq (with-current-buffer
!                                 (widget-field-buffer widget)
!                               (save-restriction
!                                 ;; `widget-narrow-to-field' can be
!                                 ;; active when this function is called
!                                 ;; from an change-functions hook. So
!                                 ;; temporarily remove field narrowing
!                                 ;; before to call `get-char-property'.
!                                 (widen)
!                                 (get-char-property (overlay-end overlay)
!                                                    'field)))
!                             'boundary))
!                    (or widget-field-add-space
!                        (null (widget-get widget :size))))
!               (1- (overlay-end overlay))
!             (overlay-end overlay)))
        (cdr overlay))))

  (defun widget-field-find (pos)





reply via email to

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