all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Character FOO
@ 2012-01-24  9:18 Eli Zaretskii
  2012-01-24 11:36 ` Juanma Barranquero
  2012-01-25  0:48 ` Kenichi Handa
  0 siblings, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2012-01-24  9:18 UTC (permalink / raw)
  To: emacs-devel

In "emacs -Q" try this:

  M-: (put-text-property 149 154 'display "FOO") RET

Then move point to buffer position 149 (under F from "FOO"), and type
"C-u C-x =".  The popped up buffer shows in its first line that the
character at point is "FOO" (while the echo area says it's `e').

Bug? feature?



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

* Re: Character FOO
  2012-01-24  9:18 Character FOO Eli Zaretskii
@ 2012-01-24 11:36 ` Juanma Barranquero
  2012-01-25  0:48 ` Kenichi Handa
  1 sibling, 0 replies; 8+ messages in thread
From: Juanma Barranquero @ 2012-01-24 11:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On Tue, Jan 24, 2012 at 10:18, Eli Zaretskii <eliz@gnu.org> wrote:

> Bug? feature?

            `(("character"
               ,(format "%s (%d, #o%o, #x%x)"
                        (apply 'propertize char-description
                               (text-properties-at pos))
                        char char char))
              ...

Now, applying the properties to the char is obviously a feature. The
question is, should display properties be ignored when displaying the
character?

    Juanma



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

* Re: Character FOO
  2012-01-24  9:18 Character FOO Eli Zaretskii
  2012-01-24 11:36 ` Juanma Barranquero
@ 2012-01-25  0:48 ` Kenichi Handa
  2012-01-25  6:32   ` Eli Zaretskii
  2012-01-28 10:35   ` Eli Zaretskii
  1 sibling, 2 replies; 8+ messages in thread
From: Kenichi Handa @ 2012-01-25  0:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

In article <E1RpcW2-0004sg-SR@fencepost.gnu.org>, Eli Zaretskii <eliz@gnu.org> writes:

> In "emacs -Q" try this:
>   M-: (put-text-property 149 154 'display "FOO") RET

> Then move point to buffer position 149 (under F from "FOO"), and type
> "C-u C-x =".  The popped up buffer shows in its first line that the
> character at point is "FOO" (while the echo area says it's `e').

> Bug? feature?

It's a feature, but it has a bad effect in the above case.

C-u C-x = (describe-char) tries to display the character at position in
*Help* buffer as the same way as in the original buffer by
adding the same text properties.

      (setq item-list
            `(("character"
               ,(format "%s (%d, #o%o, #x%x)"
                        (apply 'propertize char-description
                               (text-properties-at pos))
                        char char char))

Changing that part to something like this:

      (setq item-list
            `(("character"
               ,(format "%s (displayed as %s) (%d, #o%o, #x%x)"
			char-description
                        (apply 'propertize char-description
                               (text-properties-at pos))
                        char char char))

may be an improvement.

---
Kenichi Handa
handa@m17n.org



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

* Re: Character FOO
  2012-01-25  0:48 ` Kenichi Handa
@ 2012-01-25  6:32   ` Eli Zaretskii
  2012-01-25 16:58     ` Drew Adams
  2012-01-28 10:35   ` Eli Zaretskii
  1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2012-01-25  6:32 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

> From: Kenichi Handa <handa@m17n.org>
> Cc: emacs-devel@gnu.org
> Date: Wed, 25 Jan 2012 09:48:09 +0900
> 
>       (setq item-list
>             `(("character"
>                ,(format "%s (%d, #o%o, #x%x)"
>                         (apply 'propertize char-description
>                                (text-properties-at pos))
>                         char char char))
> 
> Changing that part to something like this:
> 
>       (setq item-list
>             `(("character"
>                ,(format "%s (displayed as %s) (%d, #o%o, #x%x)"
> 			char-description
>                         (apply 'propertize char-description
>                                (text-properties-at pos))
>                         char char char))
> 
> may be an improvement.

Thanks.

Does anyone object to this change on the trunk?



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

* RE: Character FOO
  2012-01-25  6:32   ` Eli Zaretskii
@ 2012-01-25 16:58     ` Drew Adams
  2012-01-28 10:34       ` bug#10129: " Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2012-01-25 16:58 UTC (permalink / raw)
  To: 'Eli Zaretskii', 'Kenichi Handa'; +Cc: emacs-devel

> > Changing that part to something like this: ...
> > may be an improvement.
> 
> Does anyone object to this change on the trunk?

It's a good change.

Why not apply this patch as well, while you're at it:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10129




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

* bug#10129: Character FOO
  2012-01-25 16:58     ` Drew Adams
@ 2012-01-28 10:34       ` Eli Zaretskii
  2012-01-28 10:55         ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2012-01-28 10:34 UTC (permalink / raw)
  To: Drew Adams; +Cc: 10129-done

> From: "Drew Adams" <drew.adams@oracle.com>
> Cc: <emacs-devel@gnu.org>
> Date: Wed, 25 Jan 2012 08:58:21 -0800
> 
> Why not apply this patch as well, while you're at it:
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10129

Done.  I modified your patch slightly, mainly to make it more
consistent with what "C-x =" displays.  I also updated the doc string
to bring it in line with what is in fact displayed.  The actual patch
I committed is below.

Note that your patch was backwards; please in the future use

  diff -c OLD NEW

not the other way around.

Thanks.

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2012-01-28 09:52:24 +0000
+++ lisp/ChangeLog	2012-01-28 10:27:28 +0000
@@ -1,3 +1,11 @@
+2012-01-28  Drew Adams  <drew.adams@oracle.com>
+
+	* descr-text.el (describe-char): Show information about POS, in
+	addition to information about the character at POS.  Improve and
+	update the doc string.  Change "code point" to "code point in
+	charset", to avoid confusion with the character's Unicode code
+	point shown above that.  (Bug#10129)
+
 2012-01-28  Eli Zaretskii  <eliz@gnu.org>
 
 	* descr-text.el (describe-char): Show the raw character, not only

=== modified file 'lisp/descr-text.el'
--- lisp/descr-text.el	2012-01-28 09:52:24 +0000
+++ lisp/descr-text.el	2012-01-28 10:27:28 +0000
@@ -376,12 +376,21 @@ This function is semi-obsolete.  Use `ge
 
 ;;;###autoload
 (defun describe-char (pos &optional buffer)
-  "Describe the character after POS (interactively, the character after point).
-Is POS is taken to be in buffer BUFFER or current buffer if nil.
-The information includes character code, charset and code points in it,
-syntax, category, how the character is encoded in a file,
-character composition information (if relevant),
-as well as widgets, buttons, overlays, and text properties."
+  "Describe position POS (interactively, point) and the char after POS.
+POS is taken to be in BUFFER, or the current buffer if BUFFER is nil.
+The information is displayed in buffer `*Help*'.
+
+The position information includes POS; the total size of BUFFER; the
+region limits, if narrowed; the column number; and the horizontal
+scroll amount, if the buffer is horizontally scrolled.
+
+The character information includes the character code; charset and
+code points in it; syntax; category; how the character is encoded in
+BUFFER and in BUFFER's file; character composition information (if
+relevant); the font and font glyphs used to display the character;
+the character's canonical name and other properties defined by the
+Unicode Data Base; and widgets, buttons, overlays, and text properties
+relevant to POS."
   (interactive "d")
   (unless (buffer-live-p buffer) (setq buffer (current-buffer)))
   (let ((src-buf (current-buffer)))
@@ -511,7 +520,25 @@ as well as widgets, buttons, overlays, a
             (setq composition nil)))
 
       (setq item-list
-            `(("character"
+            `(("position"
+               ,(let* ((beg      (point-min))
+                       (end      (point-max))
+                       (total    (buffer-size))
+                       (percent  (if (> total 50000) ; Avoid overflow multiplying by 100
+                                     (/ (+ (/ total 200) (1- pos))  (max (/ total 100) 1))
+                                   (/ (+ (/ total 2) (* 100 (1- pos)))  (max total 1))))
+                       (hscroll  (if (= (window-hscroll) 0)
+                                     ""
+                                   (format ", Hscroll: %d" (window-hscroll))))
+                       (col      (current-column)))
+                  (if (or (/= beg 1)  (/= end (1+ total)))
+                      (format "%d of %d (%d%%), restriction: <%d-%d>, column: %d%s"
+                              pos total percent col beg end hscroll)
+                    (if (= pos end)
+                        (format "%d of %d (EOB), column: %d%s" pos total col hscroll)
+                      (format "%d of %d (%d%%), column: %d%s"
+                              pos total percent col hscroll)))))
+              ("character"
                ,(format "%s (displayed as %s) (codepoint %d, #o%o, #x%x)"
 			char-description
                         (apply 'propertize char-description
@@ -522,7 +549,7 @@ as well as widgets, buttons, overlays, a
                   ,(symbol-name charset)
                   'type 'help-character-set 'help-args '(,charset))
                ,(format "(%s)" (charset-description charset)))
-              ("code point"
+              ("code point in charset"
                ,(let ((str (if (integerp code)
                                (format (if (< code 256) "0x%02X" "0x%04X")
                                        code)






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

* Re: Character FOO
  2012-01-25  0:48 ` Kenichi Handa
  2012-01-25  6:32   ` Eli Zaretskii
@ 2012-01-28 10:35   ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2012-01-28 10:35 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: emacs-devel

> From: Kenichi Handa <handa@m17n.org>
> Cc: emacs-devel@gnu.org
> Date: Wed, 25 Jan 2012 09:48:09 +0900
> 
> In article <E1RpcW2-0004sg-SR@fencepost.gnu.org>, Eli Zaretskii <eliz@gnu.org> writes:
> 
> > In "emacs -Q" try this:
> >   M-: (put-text-property 149 154 'display "FOO") RET
> 
> > Then move point to buffer position 149 (under F from "FOO"), and type
> > "C-u C-x =".  The popped up buffer shows in its first line that the
> > character at point is "FOO" (while the echo area says it's `e').
> 
> > Bug? feature?
> 
> It's a feature, but it has a bad effect in the above case.
> 
> C-u C-x = (describe-char) tries to display the character at position in
> *Help* buffer as the same way as in the original buffer by
> adding the same text properties.
> 
>       (setq item-list
>             `(("character"
>                ,(format "%s (%d, #o%o, #x%x)"
>                         (apply 'propertize char-description
>                                (text-properties-at pos))
>                         char char char))
> 
> Changing that part to something like this:
> 
>       (setq item-list
>             `(("character"
>                ,(format "%s (displayed as %s) (%d, #o%o, #x%x)"
> 			char-description
>                         (apply 'propertize char-description
>                                (text-properties-at pos))
>                         char char char))
> 
> may be an improvement.

Thanks, I installed this change.



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

* bug#10129: Character FOO
  2012-01-28 10:34       ` bug#10129: " Eli Zaretskii
@ 2012-01-28 10:55         ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2012-01-28 10:55 UTC (permalink / raw)
  To: 10129

> Date: Sat, 28 Jan 2012 12:34:08 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 10129-done@debbugs.gnu.org
> 
> > From: "Drew Adams" <drew.adams@oracle.com>
> > Cc: <emacs-devel@gnu.org>
> > Date: Wed, 25 Jan 2012 08:58:21 -0800
> > 
> > Why not apply this patch as well, while you're at it:
> > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10129
> 
> Done.

Forgot to tell: the change is in revision 106975 on the trunk.





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

end of thread, other threads:[~2012-01-28 10:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-24  9:18 Character FOO Eli Zaretskii
2012-01-24 11:36 ` Juanma Barranquero
2012-01-25  0:48 ` Kenichi Handa
2012-01-25  6:32   ` Eli Zaretskii
2012-01-25 16:58     ` Drew Adams
2012-01-28 10:34       ` bug#10129: " Eli Zaretskii
2012-01-28 10:55         ` Eli Zaretskii
2012-01-28 10:35   ` Eli Zaretskii

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.