GNU bug report logs - #15925
24.3.50; error when customizing whitespace-display-mappings

Previous Next

Package: emacs;

Reported by: Claudio Bley <claudio.bley <at> googlemail.com>

Date: Tue, 19 Nov 2013 07:39:02 UTC

Severity: normal

Tags: fixed, patch

Merged with 21771, 28183, 31869

Found in versions 24.3.50, 25.0.50, 27.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Claudio Bley <claudio.bley <at> googlemail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 15925 <at> debbugs.gnu.org
Subject: bug#15925: 24.3.50; error when customizing whitespace-display-mappings
Date: Wed, 20 Nov 2013 11:35:08 +0100
At Tue, 19 Nov 2013 03:24:02 -0500,
Glenn Morris wrote:
> 
> Claudio Bley wrote:
> 
> > I think the regexp should be changed to "\\`\(.\|\n\)\\'" to allow a
> > single newline also.
> 
> We already tried that once; it caused more problems than it solved:
> http://debbugs.gnu.org/2689

I see. So lets get this solved.

At first, changing the regexp is just the right thing to do and
in itself, IMO, does not break anything.

Alas, it does not solve the problem at hand because
`widget-specify-field' behaves /badly/ when the field ends with a
newline.

So, actually, this hunk of your patch trying to work around
this behaviour broke other things.

How about using a special :value-create function for character fields?

Furthermore, the presentation of the character values is bad,
usability-wise, because for nonprintable chars you cannot see what
value the field actually has.

How about displaying those chars in the buffer in another format?
E.g. use escape sequences like \n \r et cetera?

I (rather hackish) way to fix this would be to always insert a ?\n
as part of the value of a character field:

(defun widget-field-char-create (widget)
  "Create an editable character field."
  (let ((value (widget-get widget :value))
	(from (point))
	;; This is changed to a real overlay in `widget-setup'.  We
	;; need the end points to behave differently until
	;; `widget-setup' is called.
	(overlay (cons (make-marker) (make-marker))))
    (widget-put widget :field-overlay overlay)
    (insert value)
    (insert ?\n) ;; EEEK
    (unless (memq widget widget-field-list)
      (setq widget-field-new (cons widget widget-field-new)))
    (move-marker (cdr overlay) (point))
    (set-marker-insertion-type (cdr overlay) nil)
    (insert ?\n)
    (move-marker (car overlay) from)
    (set-marker-insertion-type (car overlay) t)))

What do you think?
-- 
Claudio




This bug report was last modified 4 years and 238 days ago.

Previous Next


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