[elpa] master 9651cc6: Use "git worktree list" in archive-contents.el
branch: master commit 9651cc682f02ff685dac840c51dd16f40fd0e927 Author: Eli Zaretskii Commit: Eli Zaretskii Use "git worktree list" in archive-contents.el * admin/archive-contents.el (archive--use-worktree-p): Use "git worktree list", as "--help" pops up the system Web browser on MS-Windows. --- admin/archive-contents.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/archive-contents.el b/admin/archive-contents.el index 322eef9..9952469 100644 --- a/admin/archive-contents.el +++ b/admin/archive-contents.el @@ -704,7 +704,7 @@ If WITH-CORE is non-nil, it means we manage :core packages as well." (setq archive--use-worktree (list (ignore-errors - (zerop (call-process "git" nil nil nil "worktree" "--help")) + (zerop (call-process "git" nil nil nil "worktree" "list")) (car archive--use-worktree)) (defun archive--external-package-sync (name)
[elpa] master 5a31ca8: * nhexl-mode.el (nhexl-nibble-edit-mode): New minor mode
branch: master commit 5a31ca86e0e2eeae0d1e1a912cf49d674bc1413f Author: Stefan Monnier Commit: Stefan Monnier * nhexl-mode.el (nhexl-nibble-edit-mode): New minor mode --- packages/nhexl-mode/nhexl-mode.el | 181 +- 1 file changed, 158 insertions(+), 23 deletions(-) diff --git a/packages/nhexl-mode/nhexl-mode.el b/packages/nhexl-mode/nhexl-mode.el index e4ebc14..75a949f 100644 --- a/packages/nhexl-mode/nhexl-mode.el +++ b/packages/nhexl-mode/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, 2012, 2016 Free Software Foundation, Inc. +;; Copyright (C) 2010, 2012, 2016, 2018 Free Software Foundation, Inc. ;; Author: Stefan Monnier ;; Keywords: data -;; Version: 0.2 +;; Version: 0.3 ;; Package-Requires: ((emacs "24") (cl-lib "0.5")) ;; This program is free software; you can redistribute it and/or modify @@ -28,10 +28,15 @@ ;; This minor mode implements similar functionality to `hexl-mode', ;; but using a different implementation technique, which makes it ;; usable as a "plain" minor mode. It works on any buffer, and does -;; not mess with the undo boundary or with the major mode. +;; not mess with the undo log or with the major mode. ;; ;; 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. ;;; Todo: ;; - Clicks on the hex side should put point at the right place. @@ -59,10 +64,113 @@ (defvar nhexl--point nil) (make-variable-buffer-local 'nhexl--point) +(defvar nhexl-nibble-edit-mode-map + (let ((map (make-sparse-keymap))) +(define-key map [remap self-insert-command] #'nhexl-nibble-self-insert) +(define-key map [remap right-char] #'nhexl-nibble-forward) +(define-key map [remap forward-char] #'nhexl-nibble-forward) +(define-key map [remap left-char] #'nhexl-nibble-backward) +(define-key map [remap backward-char] #'nhexl-nibble-backward) +(define-key map [remap next-line] #'nhexl-nibble-next-line) +(define-key map [remap previous-line] #'nhexl-nibble-previous-line) +map)) + +(define-minor-mode nhexl-nibble-edit-mode + "Minor mode to edit the hex nibbles in `nhexl-mode'." + :global nil + (if nhexl-nibble-edit-mode + (setq-local cursor-type 'hbar) +(kill-local-variable 'cursor-type)) + (nhexl--refresh-cursor)) + +(defvar-local nhexl--nibble nil) + +(defun nhexl--nibble (&optional pos) + (or (and (eq (or pos (point)) (nth 1 nhexl--nibble)) + (eq (buffer-chars-modified-tick) (nth 2 nhexl--nibble)) + (nth 0 nhexl--nibble)) + (progn +(setq nhexl--nibble nil) +0))) + +(defun nhexl--nibble-set (n) + (setq nhexl--nibble (list n (point) (buffer-chars-modified-tick + +(defun nhexl--refresh-cursor (&optional pos) + (unless pos (setq pos (point))) + (let* ((zero (save-restriction (widen) (point-min))) + (n (truncate (- pos zero) nhexl-line-width)) + (from (max (point-min) (+ zero (* n nhexl-line-width + (to (min (point-max) (+ zero (* (1+ n) nhexl-line-width) +(with-silent-modifications + (put-text-property from to 'fontified nil + +(defun nhexl--nibble-max (&optional char) + (unless char (setq char (following-char))) + (if (< char 256) 1 +(let ((i 1)) + (setq char (/ char 256)) + (while (> char 0) +(setq char (/ char 16)) +(setq i (1+ i))) + i))) + +(defun nhexl-nibble-forward () + "Advance by one nibble." + (interactive) + (let ((nib (nhexl--nibble))) +(if (>= nib (nhexl--nibble-max)) +(forward-char 1) + (nhexl--nibble-set (1+ nib)) + (nhexl--refresh-cursor + +(defun nhexl-nibble-backward () + "Advance by one nibble." + (interactive) + (let ((nib (nhexl--nibble))) +(if (> nib 0) +(progn + (nhexl--nibble-set (1- nib)) + (nhexl--refresh-cursor)) + (backward-char 1) + (nhexl--nibble-set (nhexl--nibble-max) + +(defun nhexl-nibble-next-line () + "Go to next line, preserving the nibble position." + (interactive) + (let ((nib (nhexl--nibble))) +(call-interactively 'next-line) +(nhexl--nibble-set nib))) + +(defun nhexl-nibble-previous-line () + "Go to next line, preserving the nibble position." + (interactive) + (let ((nib (nhexl--nibble))) +(call-interactively 'previous-line) +(nhexl--nibble-set nib))) + +(defun nhexl-nibble-self-insert () + "Overwrite current nibble with the hex character you type." + (interactive) + (let* ((max (nhexl--nibble-max)) + (nib (min max (nhexl--nibble))) + (char (following-char)) + (hex (format "%02x" char
[elpa] master 57dbff1: * nhexl-mode.el: Add our own line-movement functions
branch: master commit 57dbff11b3293a71bc8ed7b3be648cbc759d562c Author: Stefan Monnier Commit: Stefan Monnier * nhexl-mode.el: Add our own line-movement functions (nhexl-mode-map): New keymap. (nhexl-next-line, nhexl-previous-line): New commands. (nhexl-nibble-next-line, nhexl-nibble-previous-line): Remove. --- packages/nhexl-mode/nhexl-mode.el | 54 +++ 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/packages/nhexl-mode/nhexl-mode.el b/packages/nhexl-mode/nhexl-mode.el index 75a949f..f125bfc 100644 --- a/packages/nhexl-mode/nhexl-mode.el +++ b/packages/nhexl-mode/nhexl-mode.el @@ -64,6 +64,8 @@ (defvar nhexl--point nil) (make-variable-buffer-local 'nhexl--point) + Nibble editing minor mode + (defvar nhexl-nibble-edit-mode-map (let ((map (make-sparse-keymap))) (define-key map [remap self-insert-command] #'nhexl-nibble-self-insert) @@ -71,8 +73,6 @@ (define-key map [remap forward-char] #'nhexl-nibble-forward) (define-key map [remap left-char] #'nhexl-nibble-backward) (define-key map [remap backward-char] #'nhexl-nibble-backward) -(define-key map [remap next-line] #'nhexl-nibble-next-line) -(define-key map [remap previous-line] #'nhexl-nibble-previous-line) map)) (define-minor-mode nhexl-nibble-edit-mode @@ -135,20 +135,6 @@ (backward-char 1) (nhexl--nibble-set (nhexl--nibble-max) -(defun nhexl-nibble-next-line () - "Go to next line, preserving the nibble position." - (interactive) - (let ((nib (nhexl--nibble))) -(call-interactively 'next-line) -(nhexl--nibble-set nib))) - -(defun nhexl-nibble-previous-line () - "Go to next line, preserving the nibble position." - (interactive) - (let ((nib (nhexl--nibble))) -(call-interactively 'previous-line) -(nhexl--nibble-set nib))) - (defun nhexl-nibble-self-insert () "Overwrite current nibble with the hex character you type." (interactive) @@ -166,6 +152,22 @@ (backward-char 1) (nhexl--nibble-set (1+ nib) + Main minor mode + +(defvar nhexl-mode-map + (let ((map (make-sparse-keymap))) +;; `next-line' and `previous-line' work correctly, but they take ages in +;; large buffers and allocate an insane amount of memory, so the GC is +;; constantly triggered. +;; So instead we just override them with our own custom-tailored functions +;; which don't have to work nearly as hard to figure out where's the +;; next line. +;; FIXME: It would also be good to try and improve `next-line' and +;; `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) +;; FIXME: Find a key binding for nhexl-nibble-edit-mode! +map)) ;;;###autoload (define-minor-mode nhexl-mode @@ -197,6 +199,26 @@ (add-hook 'post-command-hook #'nhexl--post-command nil 'local) (add-hook 'after-change-functions #'nhexl--change-function nil 'local))) +(defun nhexl-next-line (&optional arg) + "Move cursor vertically down ARG lines." + (interactive "p") + (unless arg (setq arg 1)) + (if (< arg 0) + (nhexl-previous-line (- arg)) +(let ((nib (nhexl--nibble))) + (forward-char (* arg nhexl-line-width)) + (nhexl--nibble-set nib + +(defun nhexl-previous-line (&optional arg) + "Move cursor vertically up ARG lines." + (interactive "p") + (unless arg (setq arg 1)) + (if (< arg 0) + (nhexl-next-line (- arg)) +(let ((nib (nhexl--nibble))) + (backward-char (* arg nhexl-line-width)) + (nhexl--nibble-set nib + (defun nhexl--change-function (beg end len) ;; Round modifications up-to the hexl-line length since nhexl--jit will need ;; to modify the overlay that covers that text.