emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/nhexl-mode ec80692 22/23: * packages/nhexl-mode/nhexl-m


From: Stefan Monnier
Subject: [elpa] externals/nhexl-mode ec80692 22/23: * packages/nhexl-mode/nhexl-mode.el (nhexl-mode-map): Remap EOL/BOL
Date: Sat, 28 Nov 2020 18:35:46 -0500 (EST)

branch: externals/nhexl-mode
commit ec80692dec04e238f2ae3284cfd8f9d05ac1d2a3
Author: Alessio Di Mauro <dimauro.alessio@gmail.com>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * packages/nhexl-mode/nhexl-mode.el (nhexl-mode-map): Remap EOL/BOL
    
    Copyright-paperwork-exempt: yes
    
    (nhexl-move-beginning-of-line, nhexl-move-end-of-line): New commands
---
 nhexl-mode.el | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/nhexl-mode.el b/nhexl-mode.el
index 220b6a5..e1fe6aa 100644
--- a/nhexl-mode.el
+++ b/nhexl-mode.el
@@ -1,10 +1,10 @@
 ;;; nhexl-mode.el --- Minor mode to edit files via hex-dump format  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2010-2019  Free Software Foundation, Inc.
+;; Copyright (C) 2010-2020  Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: data
-;; Version: 1.4
+;; Version: 1.5
 ;; Package-Requires: ((emacs "24.4") (cl-lib "0.5"))
 
 ;; This program is free software; you can redistribute it and/or modify
@@ -357,6 +357,9 @@ existing text, if needed with `nhexl-overwrite-clear-byte'."
     ;; `previous-line' for this case, tho it is pretty pathological for them.
     (define-key map [remap next-line] #'nhexl-next-line)
     (define-key map [remap previous-line] #'nhexl-previous-line)
+    (define-key map [remap move-end-of-line] #'nhexl-move-end-of-line)
+    (define-key map [remap move-beginning-of-line]
+      #'nhexl-move-beginning-of-line)
     ;; Just as for line movement, scrolling movement could/should work as-is
     ;; but benefit from an ad-hoc implementation.
     (define-key map [remap scroll-up-command] #'nhexl-scroll-up)
@@ -460,6 +463,20 @@ existing text, if needed with 
`nhexl-overwrite-clear-byte'."
       (backward-char (* arg (nhexl--line-width)))
       (nhexl--nibble-set nib))))
 
+(defun nhexl-move-beginning-of-line (&optional arg)
+  "Move to beginning of the hex line that lies ARG - 1 hex lines ahead."
+  (interactive "p")
+  (unless arg (setq arg 1))
+  (nhexl-next-line (- arg 1))
+  (backward-char (mod (- (point) 1) nhexl-line-width)))
+
+(defun nhexl-move-end-of-line (&optional arg)
+  "Move to end of the hex line that lies ARG - 1 hex lines ahead."
+  (interactive "p")
+  (unless arg (setq arg 1))
+  (nhexl-next-line (- arg 1))
+  (forward-char (- nhexl-line-width 1 (mod (- (point) 1) nhexl-line-width))))
+
 (defun nhexl-scroll-down (&optional arg)
   "Scroll text of selected window down ARG lines; or near full screen if no 
ARG."
   (interactive "P")



reply via email to

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