unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#10129: 24.0.91; [PATCH] `C-u C-x =' should show position info
@ 2011-11-24 18:50 Drew Adams
  0 siblings, 0 replies; only message in thread
From: Drew Adams @ 2011-11-24 18:50 UTC (permalink / raw)
  To: 10129

[-- Attachment #1: Type: text/plain, Size: 1125 bytes --]

`C-x =' shows information about the current position, including its
relation to the buffer size, its column, the region limits, and
horizontal scroll amount.
 
That position info is missing from the *Help* display for `C-u C-x ='.
It is only shown in the message, which is ephemeral and can easily be
overwritten.
 
The attached patch remedies this by including the position information
in *Help*.  The patch also updates the doc string accordingly (and
corrects improper grammar such as "Is POS is taken...").

In GNU Emacs 24.0.91.1 (i386-mingw-nt5.1.2600) of 2011-11-21 on MARVIN
 Windowing system distributor `Microsoft Corp.', version 5.1.2600
 configured using `configure --with-gcc (4.6) --no-opt --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-2.10.1/include --ldflags
 -LD:/devel/emacs/libs/gnutls-2.10.1/lib'
 

[-- Attachment #2: descr-text-2011-11-24a.patch --]
[-- Type: application/octet-stream, Size: 3500 bytes --]

diff -c -w descr-text-patched.el descr-text.el
*** descr-text-patched.el	Thu Nov 24 10:42:16 2011
--- descr-text.el	Thu Nov 24 10:39:32 2011
***************
*** 376,393 ****
  
  ;;;###autoload
  (defun describe-char (pos &optional buffer)
!   "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 horizontally scrolled.
! 
! The character information includes the character code; charset and
! code points in it; syntax; category; how the character is encoded in a
! file; character composition information (if relevant); and relevant
! widgets, buttons, overlays, and text properties."
    (interactive "d")
    (unless (buffer-live-p buffer) (setq buffer (current-buffer)))
    (let ((src-buf (current-buffer)))
--- 376,387 ----
  
  ;;;###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."
    (interactive "d")
    (unless (buffer-live-p buffer) (setq buffer (current-buffer)))
    (let ((src-buf (current-buffer)))
***************
*** 503,527 ****
              (setq composition nil)))
  
        (setq item-list
!             `(("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%%), column: %d%s, region: %d-%d"
!                                   pos total percent col hscroll beg end)
!                         (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 (%d, #o%o, #x%x)"
                          (apply 'propertize char-description
                                 (text-properties-at pos))
--- 497,503 ----
              (setq composition nil)))
  
        (setq item-list
!             `(("character"
                 ,(format "%s (%d, #o%o, #x%x)"
                          (apply 'propertize char-description
                                 (text-properties-at pos))

Diff finished.  Thu Nov 24 10:43:41 2011

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-24 18:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-24 18:50 bug#10129: 24.0.91; [PATCH] `C-u C-x =' should show position info Drew Adams

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).