From: Andreas Kremser <kremser.andreas@googlemail.com>
To: 10725@debbugs.gnu.org
Subject: bug#10725: Hexl-Mode:Feature: Direct hex input in hex-area
Date: Sat, 4 Feb 2012 20:03:16 +0100 [thread overview]
Message-ID: <CAArBxB427FUWGyrKaqCHe7OSwk6hQ2nCanCU+bMdJj1fRn31Aw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 379 bytes --]
** Description
Allow directly entering hex-values in hexl mode while in
hex-area. Changed hexl-insert-char to treat text entered into the
hex-area differnt from text enterd into the ascii-area.
** ChangeLog
2012-02-04 Andreas Kremser <kremser.andreas@googlemail.com>
* hexl.el (hexl-insert-char): Allow directly entering
hex-values in hexl mode while in hex-area.
[-- Attachment #2: HEXLDHI.txt --]
[-- Type: text/plain, Size: 5548 bytes --]
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: kremser.andreas@googlemail.com-20120204184227-\
# vshwnek1lbyc32vb
# target_branch: bzr://bzr.savannah.gnu.org/emacs/trunk/
# testament_sha1: 4774810212441e716205190945f17efbf28fa08f
# timestamp: 2012-02-04 19:59:34 +0100
# base_revision_id: cyd@gnu.org-20120204151054-0ngdswa8xslby3aw
#
# Begin patch
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog 2012-02-04 09:57:09 +0000
+++ lisp/ChangeLog 2012-02-04 18:42:27 +0000
@@ -1,3 +1,7 @@
+2012-02-04 Andreas Kremser <kremser.andreas@googlemail.com>
+
+ * hexl.el (hexl-insert-char): Allow directly entering hex-values in hexl mode while in hex-area.
+
2012-02-04 Lars Ljung <lars@matholka.se> (tiny change)
* eshell/esh-ext.el (eshell-windows-shell-file): Match "cmdproxy"
=== modified file 'lisp/hexl.el'
--- lisp/hexl.el 2012-01-19 07:21:25 +0000
+++ lisp/hexl.el 2012-02-04 18:40:09 +0000
@@ -918,6 +918,52 @@
(/ (% address 16) 2)))
(ascii-position
(+ (* (/ address 16) 68) 51 (point-min) (% address 16)))
+ (low-ch (downcase ch)))
+ (if (= (point) ascii-position)
+ (progn
+ (goto-char hex-position)
+ (delete-char 2)
+ (insert (format "%02x" ch))
+ (goto-char ascii-position)
+ (delete-char 1)
+ (insert (hexl-printable-character ch))
+ (or (eq address hexl-max-address)
+ (setq address (1+ address)))
+ (hexl-goto-address address)
+ (beginning-of-line)
+ (forward-char 51)
+ (forward-char (% address 16)))
+ (if (or (and (>= ch (string-to-char "0")) (<= ch (string-to-char "9")))
+ (and (>= low-ch (string-to-char "a")) (<= low-ch (string-to-char "f"))))
+ (progn
+ (goto-char (max (- (point) (point-min) -1)
+ (hexl-address-to-marker address)))
+ (delete-char 1)
+ (insert low-ch)
+ (let ((curp (point))
+ (av (+ (* 16 (hexl-hex-char-to-integer (char-after hex-position )))
+ (hexl-hex-char-to-integer (char-after (+ 1 hex-position))))))
+ (goto-char ascii-position)
+ (delete-char 1)
+ (insert (hexl-printable-character av))
+ (goto-char curp)))))
+ (setq num (1- num))))))
+
+(defun hexl-insert-char (ch num)
+ "Insert the character CH NUM times in a hexl buffer.
+
+CH must be a unibyte character whose value is between 0 and 255."
+ (if (or (< ch 0) (> ch 255))
+ (error "Invalid character 0x%x -- must be in the range [0..255]" ch))
+ (let ((address (hexl-current-address t)))
+ (while (> num 0)
+ (let ((hex-position
+ (+ (* (/ address 16) 68)
+ 10 (point-min)
+ (* 2 (% address 16))
+ (/ (% address 16) 2)))
+ (ascii-position
+ (+ (* (/ address 16) 68) 51 (point-min) (% address 16)))
at-ascii-position)
(if (= (point) ascii-position)
(setq at-ascii-position t))
# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWUNsXOMABOLfgHAwUnv/93pv
Cgq////wYAjdU+uuOCg6KGO7hR0mzSSgNDFJkyk9GiHlPQ2oQ0NBoyBoeoMmmgJKU9EaPKT2k8k0
1GgaaNAGQAANAcwCYCZGAEYmJhMJghpiaYCREJE2ppqeTSNqeU9T01Gh6mnqND0gaGg0HMAmAmRg
BGJiYTCYI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L0IkGqtA/JF4qmIC9
YAWUitS9Kz5LIz5jJknRSXCrzA52SWMfhehBok0HE1EEQRENDBjGm0MITIcDoW83BRRiAtV917IR
nIFIAuPkVosRDZ6MsAzKpihAkxXmqBE5jANoBSmvaQMiLdxrNCIkRwkNRqArdEt5qQRgvYVyCkCC
2GbIbzUlaIMRioCwGmsr5J0+A96zZxkRGVgmJHnQESJ3m5F5BVi3DFZl8WkbwyArU9wMhlgBYK8c
HgMqmSoJdyCCMrg54kQa6ostWpiUTuXwL4QREwK9BEWKVacX1KxwXd8UEHLFBR6wzNpBUITBBqTA
G41SKxcmFov7vMF3AuTsFtZ/8XckU4UJBDbFzjA=
next reply other threads:[~2012-02-04 19:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-04 19:03 Andreas Kremser [this message]
2016-02-24 6:49 ` bug#10725: Hexl-Mode:Feature: Direct hex input in hex-area Lars Ingebrigtsen
2019-06-27 15:33 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAArBxB427FUWGyrKaqCHe7OSwk6hQ2nCanCU+bMdJj1fRn31Aw@mail.gmail.com \
--to=kremser.andreas@googlemail.com \
--cc=10725@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.