[elpa] master fccc196: * nhexl-mode.el (nhexl-overwrite-only-mode): New minor mode.

2018-04-15 Thread Stefan Monnier
branch: master
commit fccc19666d30a0643942e6a35e6223d03ef42c76
Author: Stefan Monnier 
Commit: Stefan Monnier 

* nhexl-mode.el (nhexl-overwrite-only-mode): New minor mode.
---
 packages/nhexl-mode/nhexl-mode.el | 110 --
 1 file changed, 105 insertions(+), 5 deletions(-)

diff --git a/packages/nhexl-mode/nhexl-mode.el 
b/packages/nhexl-mode/nhexl-mode.el
index f125bfc..ca12ed2 100644
--- a/packages/nhexl-mode/nhexl-mode.el
+++ b/packages/nhexl-mode/nhexl-mode.el
@@ -33,10 +33,16 @@
 ;; In theory it could also work just fine even on very large buffers,
 ;; although in practice it seems to make the display engine suffer.
 ;;
-;; It also comes with a "nibble editor" mode (M-x nhexl-nibble-edit-mode),
-;; where the cursor pretends to advance by nibbles (4-bit) and the
-;; self-insertion keys (which only work for hex-digits) will only modify the
-;; nibble under point.
+;; It also comes with:
+;;
+;; - `nhexl-nibble-edit-mode': a "nibble editor" minor mode.
+;;   where the cursor pretends to advance by nibbles (4-bit) and the
+;;   self-insertion keys (which only work for hex-digits) will only modify the
+;;   nibble under point.
+;;
+;; - `nhexl-overwrite-only-mode': a minor mode to try and avoid moving text.
+;;   In this minor mode, not only self-inserting keys overwrite existing
+;;   text, but commands like `yank' and `kill-region' as well.
 
 ;;; Todo:
 ;; - Clicks on the hex side should put point at the right place.
@@ -151,7 +157,101 @@
 (if (= max nib) nil
   (backward-char 1)
   (nhexl--nibble-set (1+ nib)
-
+
+ No insertion/deletion minor mode
+
+(defvar nhexl-overwrite-clear-byte ?\000
+  "Byte to use to replace deleted content.")
+
+(defvar nhexl-overwrite-only-mode-map
+  (let ((map (make-sparse-keymap)))
+(define-key map [remap yank] #'nhexl-overwrite-yank)
+(define-key map [remap yank-pop] #'nhexl-overwrite-yank-pop)
+(define-key map [remap kill-region] #'nhexl-overwrite-kill-region)
+(define-key map [remap delete-char] #'nhexl-overwrite-delete-char)
+(define-key map [remap backward-delete-char-untabify]
+  #'nhexl-overwrite-backward-delete-char)
+map))
+
+(defun nhexl-overwrite-backward-delete-char (&optional arg)
+  "Delete ARG chars backward by overwriting them.
+Uses `nhexl-overwrite-clear-byte'."
+  (interactive "p")
+  (unless arg (setq arg 1))
+  (if (< arg 0)
+  (nhexl-overwrite-delete-char (- arg))
+(forward-char (- arg))
+(save-excursion
+  (insert-char nhexl-overwrite-clear-byte arg)
+  (delete-char arg
+
+(defun nhexl-overwrite-delete-char (&optional arg)
+  "Delete ARG chars forward by overwriting them.
+Uses `nhexl-overwrite-clear-byte'."
+  (interactive "p")
+  (unless arg (setq arg 1))
+  (if (< arg 0)
+  (nhexl-overwrite-backward-delete-char (- arg))
+(insert-char nhexl-overwrite-clear-byte arg)
+(delete-char arg)))
+
+(defun nhexl-overwrite-kill-region (beg end &optional region)
+  "Kill the region, replacing it with `nhexl-overwrite-clear-byte'."
+  (interactive (list (mark) (point) 'region))
+  (copy-region-as-kill beg end region)
+  (barf-if-buffer-read-only)
+  (pcase-dolist (`(,beg . ,end)
+ (if region (funcall region-extract-function 'bounds)
+   (list beg end)))
+(goto-char beg)
+(nhexl-overwrite-delete-char (- end beg
+
+(defun nhexl-overwrite--yank-wrapper (fun)
+  ;; FIXME? doesn't work when yanking things like rectangles.
+  (let ((orig-size (buffer-size)))
+(funcall fun)
+(let* ((inserted (- (buffer-size) orig-size))
+   (deleted (delete-and-extract-region
+ (point)
+ (min (point-max) (+ (point) inserted)
+  (unless yank-undo-function
+(setq yank-undo-function #'delete-region))
+  (add-function :before yank-undo-function
+(lambda (_beg end)
+  (save-excursion
+(goto-char end)
+(insert deleted)))
+
+(defun nhexl-overwrite-yank (&optional arg)
+  "Like `yank' but overwriting existing text."
+  (interactive "*P")
+  (nhexl-overwrite--yank-wrapper (lambda () (yank arg
+
+(defun nhexl-overwrite-yank-pop (&optional arg)
+  "Like `yank-pop' but overwriting existing text."
+  (interactive "*P")
+  (nhexl-overwrite--yank-wrapper (lambda () (yank-pop arg
+
+(defvar-local nhexl--overwrite-save-settings nil)
+
+(define-minor-mode nhexl-overwrite-only-mode
+  "Minor mode where text is only overwritten.
+Insertion/deletion is avoided where possible and replaced by overwriting
+existing text, if needed with `nhexl-overwrite-clear-byte'."
+  :lighter nil
+  (cond
+   (nhexl-overwrite-only-mode
+(push (cons 'overwrite-mode overwrite-mode)
+  nhexl--overwrite-save-settings)
+(setq-local overwrite-mode 'overwrite-mode-binary)
+(setq-local overwrite-mode-binary " OnlyOvwrt"))
+   (t
+(pcase-dolist (`(,var . ,val)
+  

[elpa] master fc8ae0e: * nhexl-mode.el: Bump version number for new release

2018-04-15 Thread Stefan Monnier
branch: master
commit fc8ae0ec25e28a3429d5c798b4d87ac87780759d
Author: Stefan Monnier 
Commit: Stefan Monnier 

* nhexl-mode.el: Bump version number for new release
---
 packages/nhexl-mode/nhexl-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packages/nhexl-mode/nhexl-mode.el 
b/packages/nhexl-mode/nhexl-mode.el
index ca12ed2..f698152 100644
--- a/packages/nhexl-mode/nhexl-mode.el
+++ b/packages/nhexl-mode/nhexl-mode.el
@@ -4,7 +4,7 @@
 
 ;; Author: Stefan Monnier 
 ;; Keywords: data
-;; Version: 0.3
+;; Version: 0.4
 ;; Package-Requires: ((emacs "24") (cl-lib "0.5"))
 
 ;; This program is free software; you can redistribute it and/or modify



[elpa] externals/xelb 0a46cc6: Port to 32-bit Emacs master

2018-04-15 Thread Paul Eggert
branch: externals/xelb
commit 0a46cc62a3a82dcaa1d1bf0929a5207260f635e3
Author: Paul Eggert 
Commit: Paul Eggert 

Port to 32-bit Emacs master

Rewrite #x to 4294967295. and similarly for other
hex constants intended to be floating-point on 32-bit Emacs.
* el_client.el (xelb-parse-enum):
Omit enums that do not fit in 32-bit Emacs.
* xcb-xinput.el (xcb:xinput:ModifierMask:Any):
* xcb-xkb.el (xcb:xkb:Control:IgnoreLockMods)
(xcb:xkb:Control:PerKeyRepeat, xcb:xkb:Control:ControlsEnabled):
Remove.
---
 el_client.el  |  8 +++-
 xcb-cursor.el |  2 +-
 xcb-icccm.el  |  2 +-
 xcb-types.el  | 28 ++--
 xcb-xinput.el |  2 --
 xcb-xkb.el|  3 ---
 6 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/el_client.el b/el_client.el
index 9b7077f..393745e 100644
--- a/el_client.el
+++ b/el_client.el
@@ -351,7 +351,13 @@ an `xelb-auto-padding' attribute."
 (if expression
 (setq value (xelb-parse-expression expression))
   (setq value (1+ value)))
-`(defconst ,name ,value
+   ;; Omit the rare enums that do not fit in a fixnum in
+   ;; 32-bit Emacs, so that the resulting .el and .elc
+   ;; files are portable to 32-bit Emacs.  Admittedly
+   ;; this is a kludge.
+   (unless (and ((integerp value)
+ (not (<= -536870912 value 536870911
+ `(defconst ,name ,value)
   items
 
 (defun xelb-parse-typedef (node)
diff --git a/xcb-cursor.el b/xcb-cursor.el
index 12bbf27..71842a3 100644
--- a/xcb-cursor.el
+++ b/xcb-cursor.el
@@ -230,7 +230,7 @@
 
 (defconst xcb:cursor:-file-chunk-image-header 36
   "Header value of image-type chunk in Xcursor file.")
-(defconst xcb:cursor:-file-chunk-image-type #xFFFD0002
+(defconst xcb:cursor:-file-chunk-image-type 4294770690.
   "Type of image-type chunk in Xcursor file.")
 (defconst xcb:cursor:-file-chunk-image-version 1
   "Version of image-type chunk in Xcursor file.")
diff --git a/xcb-icccm.el b/xcb-icccm.el
index 613bed1..4599a7d 100644
--- a/xcb-icccm.el
+++ b/xcb-icccm.el
@@ -119,7 +119,7 @@ A valid timestamp (rather than `xcb:Time:CurrentTime') must 
be supplied.")
 (defclass xcb:icccm:-GetProperty (xcb:GetProperty)
   ((delete :initform 0)
(long-offset :initform 0)
-   (long-length :initform 10))  ;as long as possible
+   (long-length :initform 10.))  ;as long as possible
   :documentation "Get an ICCCM property (request part).")
 
 (defclass xcb:icccm:-GetProperty~reply (xcb:GetProperty~reply)
diff --git a/xcb-types.el b/xcb-types.el
index f5c1a3c..0c172b6 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -155,8 +155,8 @@
   (logand (lsh value -16) #xFF)
   (logand (lsh value -8) #xFF)
   (logand value #xFF))
-(let* ((msdw (min #x (truncate value #x1)))
-   (lsdw (min #x
+(let* ((msdw (min 4294967295. (truncate value 4294967296.)))
+   (lsdw (min 4294967295.
   (truncate (- value (* msdw 4294967296.0))
   (vector (logand (lsh msdw -24) #xFF) (logand (lsh msdw -16) #xFF)
   (logand (lsh msdw -8) #xFF) (logand msdw #xFF)
@@ -173,8 +173,8 @@
   (logand (lsh value -40) #xFF)
   (logand (lsh value -48) #xFF)
   (logand (lsh value -56) #xFF))
-(let* ((msdw (min #x (truncate value #x1)))
-   (lsdw (min #x
+(let* ((msdw (min 4294967295. (truncate value 4294967296.)))
+   (lsdw (min 4294967295.
   (truncate (- value (* msdw 4294967296.0))
   (vector (logand lsdw #xFF) (logand (lsh lsdw -8) #xFF)
   (logand (lsh lsdw -16) #xFF) (logand (lsh lsdw -24) #xFF)
@@ -207,11 +207,11 @@
   (vector 0 0 0 0
   (logand (lsh value -24) #xFF) (logand (lsh value -16) #xFF)
   (logand (lsh value -8) #xFF) (logand value #xFF))
-(let* ((msw (min #x (truncate value #x1)))
+(let* ((msw (min #x (truncate value 281474976710656.)))
(w1 (min #x
 (truncate (setq value
 (- value (* msw 281474976710656.0)))
-  #x1)))
+  4294967296.)))
(w2 (min #x
 (truncate (setq value (- value (* w1 4294967296.0)))
   #x1)))
@@ -226,11 +226,11 @@
   (vector (logand value #xFF) (logand (lsh value -8) #xFF)
   (logand (lsh

[elpa] externals/exwm ff4ae82: Port to 32-bit Emacs on master branch

2018-04-15 Thread Paul Eggert
branch: externals/exwm
commit ff4ae82fd7ca9101da92f21c7f46f991da99a30e
Author: Paul Eggert 
Commit: Paul Eggert 

Port to 32-bit Emacs on master branch
---
 exwm-layout.el | 2 +-
 exwm.el| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/exwm-layout.el b/exwm-layout.el
index b74f512..7642598 100644
--- a/exwm-layout.el
+++ b/exwm-layout.el
@@ -117,7 +117,7 @@
   (with-current-buffer (exwm--id->buffer id)
 (unless (or (exwm-layout--iconic-state-p)
 (and exwm--floating-frame
- (eq #x exwm--desktop)))
+ (eq 4294967295. exwm--desktop)))
   (exwm--log "Hide #x%x" id)
   (when exwm--floating-frame
 (let* ((container (frame-parameter exwm--floating-frame
diff --git a/exwm.el b/exwm.el
index 195ca7b..17f73d8 100644
--- a/exwm.el
+++ b/exwm.el
@@ -154,7 +154,7 @@
   (when reply
 (setq desktop (slot-value reply 'value))
 (cond
- ((eq desktop #x)
+ ((eq desktop 4294967295.)
   (unless (or (not exwm--floating-frame)
   (eq exwm--frame exwm-workspace--current)
   (and exwm--desktop