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

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

bug#16413: 24.3.50; Inconsistent behavior of text property functions in


From: Daniel Colascione
Subject: bug#16413: 24.3.50; Inconsistent behavior of text property functions in narrowed buffer
Date: Fri, 10 Jan 2014 20:09:37 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 01/10/2014 08:05 PM, Daniel Colascione wrote:
On 01/10/2014 07:05 PM, Nathan Trapuzzano wrote:
The various functions for examining text properties behave unintuitively
and incosistently at (point-max) on narrowed buffers.  Rather than
returning `nil', they return the prop(s) of the text at (point-max),
even though the text is not actually visible in the buffer, due to
narrowing.  By contrast, `char-after' always returns `nil' when passed
(point-max).  It seems to me the text property functions should also
return `nil', as they do at (eobp) on widened buffers.

I agree that this behavior is unintuitive, but I wonder whether we can
fix this bug without breaking existing elisp.

Which functions break, exactly? The following test passes.

(ert-deftest text-property-narrowing ()
  "Test that text properties outside narrowed buffer are invisible"
  (with-temp-buffer
    (insert "  ")
    (put-text-property (1- (point-max)) (point-max) 'foo 'bar)
    (should (eq (get-text-property (1- (point-max)) 'foo) 'bar))
    (narrow-to-region (point-min) (1- (point-max)))
    (should (null (get-text-property (1- (point-max)) 'foo)))))






reply via email to

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