unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* confusing info in C-u C-x =
@ 2005-11-20  9:55 Werner LEMBERG
  2005-11-20 15:16 ` Andreas Schwab
  2005-11-20 23:21 ` Richard M. Stallman
  0 siblings, 2 replies; 17+ messages in thread
From: Werner LEMBERG @ 2005-11-20  9:55 UTC (permalink / raw)



Pressing C-u C-x = on an underlined space character in mew shows this:

    character: SPC (040, 32, 0x20, U+0020)
    ...

  There is an overlay here:
   From 14 to 15
    face                 [underline]
    mew                  t

  ...

What does the `From 14 to 15' mean?


    Werner

^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: confusing info in C-u C-x =
@ 2005-11-20 19:35 martin rudalics
  0 siblings, 0 replies; 17+ messages in thread
From: martin rudalics @ 2005-11-20 19:35 UTC (permalink / raw)
  Cc: emacs-devel

> What does the `From 14 to 15' mean?

14 denotes the position of the character you want to describe as
replicated in the *Help* buffer, in your case the position of the `S' in
SPC.  When the character you want to describe is covered by an overlay,
`describe-char' always creates a dummy overlay of length 1 at that
position and gives it the properties of the overlay covering the
character you want to describe.  In your case there must have been at
least one overlay covering the space.  Any overlay properties there
should have been replicated correctly.  The `From 14 to 15', however,
refers to the dummy overlay in the *Help* buffer and should be, in my
opinion, omitted.

Obtaining the start/end positions of all overlays covering the character
you want to describe would require a revision of the concept sketched
above.

^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: confusing info in C-u C-x =
@ 2005-11-21  8:56 martin rudalics
  0 siblings, 0 replies; 17+ messages in thread
From: martin rudalics @ 2005-11-21  8:56 UTC (permalink / raw)
  Cc: emacs-devel

You could try the following patch:

*** descr-text.el	Sat Nov  5 20:44:24 2005
--- descr-text.el	Mon Nov 21 08:50:36 2005
***************
*** 144,160 ****
         (goto-char (point-min)))))

   ;;;###autoload
! (defun describe-text-properties (pos &optional output-buffer)
     "Describe widgets, buttons, overlays and text properties at POS.
   Interactively, describe them for the character after point.
   If optional second argument OUTPUT-BUFFER is non-nil,
   insert the output into that buffer, and don't initialize or clear it
! otherwise."
     (interactive "d")
     (if (>= pos (point-max))
         (error "No character follows specified position"))
     (if output-buffer
!       (describe-text-properties-1 pos output-buffer)
       (if (not (or (text-properties-at pos) (overlays-at pos)))
   	(message "This is plain text.")
         (let ((buffer (current-buffer))
--- 144,162 ----
         (goto-char (point-min)))))

   ;;;###autoload
! (defun describe-text-properties (pos &optional output-buffer overlay-bounds)
     "Describe widgets, buttons, overlays and text properties at POS.
   Interactively, describe them for the character after point.
   If optional second argument OUTPUT-BUFFER is non-nil,
   insert the output into that buffer, and don't initialize or clear it
! otherwise.
! Optional third argument OVERLAY-BOUNDS is a list of start and end
! positions of overlays as produced by `describe-char'."
     (interactive "d")
     (if (>= pos (point-max))
         (error "No character follows specified position"))
     (if output-buffer
!       (describe-text-properties-1 pos output-buffer overlay-bounds)
       (if (not (or (text-properties-at pos) (overlays-at pos)))
   	(message "This is plain text.")
         (let ((buffer (current-buffer))
***************
*** 171,177 ****
   	    (describe-text-mode)
   	    (goto-char (point-min))))))))

! (defun describe-text-properties-1 (pos output-buffer)
     (let* ((properties (text-properties-at pos))
   	 (overlays (overlays-at pos))
   	 (wid-field (get-char-property pos 'field))
--- 173,179 ----
   	    (describe-text-mode)
   	    (goto-char (point-min))))))))

! (defun describe-text-properties-1 (pos output-buffer &optional overlay-bounds)
     (let* ((properties (text-properties-at pos))
   	 (overlays (overlays-at pos))
   	 (wid-field (get-char-property pos 'field))
***************
*** 205,212 ****
   	  (widget-insert "There are " (format "%d" (length overlays))
   			 " overlays here:\n"))
   	(dolist (overlay overlays)
! 	  (widget-insert " From " (format "%d" (overlay-start overlay))
! 			 " to " (format "%d" (overlay-end overlay)) "\n")
   	  (describe-property-list (overlay-properties overlay)))
   	(widget-insert "\n"))
         ;; Text properties
--- 207,222 ----
   	  (widget-insert "There are " (format "%d" (length overlays))
   			 " overlays here:\n"))
   	(dolist (overlay overlays)
!           (if overlay-bounds
!               (progn
!                 ;; OVERLAY-BOUNDS must be a list of the bounds of all overlays
!                 ;; at some "original" position.  The overlays at POS are one
!                 ;; character wide replicas of the overlays at that position.
!                 (widget-insert " From " (format "%d" (caar overlay-bounds))
!                                " to " (format "%d" (cdar overlay-bounds)) "\n")
!                 (setq overlay-bounds (cdr overlay-bounds)))
!             (widget-insert " From " (format "%d" (overlay-start overlay))
!                            " to " (format "%d" (overlay-end overlay)) "\n"))
   	  (describe-property-list (overlay-properties overlay)))
   	(widget-insert "\n"))
         ;; Text properties
***************
*** 458,463 ****
--- 468,476 ----
   	 (multibyte-p enable-multibyte-characters)
   	 (overlays (mapcar #'(lambda (o) (overlay-properties o))
   			   (overlays-at pos)))
+          (overlay-bounds ; Make list of start and end positions of overlays
+           (mapcar #'(lambda (o) (cons (overlay-start o) (overlay-end o)))
+                       (nreverse (overlays-at pos))))
   	 item-list max-width unicode)

       (if (or (< char 256)
***************
*** 718,724 ****
   	  (insert "\nSee the variable `reference-point-alist' for "
   		  "the meaning of the rule.\n"))

! 	(describe-text-properties pos (current-buffer))
   	(describe-text-mode)))))

   (defalias 'describe-char-after 'describe-char)
--- 731,737 ----
   	  (insert "\nSee the variable `reference-point-alist' for "
   		  "the meaning of the rule.\n"))

! 	(describe-text-properties pos (current-buffer) overlay-bounds)
   	(describe-text-mode)))))

   (defalias 'describe-char-after 'describe-char)

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

end of thread, other threads:[~2005-12-11 16:49 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-20  9:55 confusing info in C-u C-x = Werner LEMBERG
2005-11-20 15:16 ` Andreas Schwab
2005-11-20 22:07   ` [SPAM?]: " Werner LEMBERG
2005-11-21  7:35   ` Juri Linkov
2005-12-08  1:49   ` Kenichi Handa
2005-12-09  9:57     ` Juri Linkov
2005-12-09 15:07       ` Kim F. Storm
2005-12-09 21:15       ` Richard M. Stallman
2005-12-09 23:52         ` Juri Linkov
2005-12-10 16:18           ` Richard M. Stallman
2005-12-11  0:46             ` Juri Linkov
2005-12-10 22:50           ` Kim F. Storm
2005-12-11  0:55       ` Juri Linkov
2005-12-11 16:49         ` Richard M. Stallman
2005-11-20 23:21 ` Richard M. Stallman
  -- strict thread matches above, loose matches on Subject: below --
2005-11-20 19:35 martin rudalics
2005-11-21  8:56 martin rudalics

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).