[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/poke bdba6e62bd 2/2: Add setting oindent
From: |
ELPA Syncer |
Subject: |
[elpa] externals/poke bdba6e62bd 2/2: Add setting oindent |
Date: |
Fri, 8 Apr 2022 01:57:43 -0400 (EDT) |
branch: externals/poke
commit bdba6e62bdc5021a234d41da60149be01560df3a
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Commit: Jose E. Marchesi <jose.marchesi@oracle.com>
Add setting oindent
---
poke.el | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/poke.el b/poke.el
index 9fd161d893..17f60c3d62 100644
--- a/poke.el
+++ b/poke.el
@@ -1293,12 +1293,19 @@ at the top of the `poke-maps-stack' stack."
(defvar poke-setting-omode "plain")
(defvar poke-setting-omaps "no")
(defvar poke-setting-obase 10)
+(defvar poke-setting-oindent 2)
+
+(defun poke-setting-set-oindent (val)
+ (unless (>= val 0)
+ (error "Invalid indentation step. Must be a positive integer."))
+ (poke-code-send (concat "vm_set_oindent (" (number-to-string val) ");")))
(defun poke-setting-set-endian (val)
- (unless (member val '("big" "little" "host" "network"))
- (error "Invalid setting for byte endianness.
-Expected \"big\", \"little\", \"host\" or \"network\"."))
- (poke-code-send (concat "set_endian (" val ");")))
+ (let ((endian-const (pcase val
+ ("big" "ENDIAN_BIG")
+ ("little" "ENDIAN_LITTLE")
+ (_ (error "Invalid setting for byte endianness.
Expected \"big\" or \"little\".")))))
+ (poke-code-send (concat "set_endian (" endian-const ");"))))
(defun poke-setting-set-pretty-print (val)
(unless (member val '("yes" "no"))
@@ -1334,7 +1341,8 @@ Expected 2, 8, 10 or 16."))
(defun poke-init-settings ()
(poke-setting-set-pretty-print poke-setting-pretty-print)
(poke-setting-set-omode poke-setting-omode)
- (poke-setting-set-endian poke-setting-endian))
+ (poke-setting-set-endian poke-setting-endian)
+ (poke-setting-set-oindent poke-setting-oindent))
(defvar poke-settings-map
(let ((map (make-sparse-keymap)))
@@ -1353,7 +1361,7 @@ Expected 2, 8, 10 or 16."))
:notify (lambda (widget &rest _)
(poke-setting-set-endian (widget-value widget))
(setq poke-setting-endian (widget-value widget)))
- '(item "little") '(item "big") '(item "host") '(item
"network"))
+ '(item "little") '(item "big"))
(widget-insert "\n")
(widget-insert "Output mode:\n")
(widget-create 'radio-button-choice
@@ -1387,9 +1395,16 @@ Expected 2, 8, 10 or 16."))
(setq poke-setting-omaps (widget-value widget)))
'(item "yes") '(item "no"))
(widget-insert "\n")
+ (widget-insert "Indentation step:\n")
+ (widget-create 'integer
+ :size 2
+ :value poke-setting-oindent
+ :action (lambda (widget &rest _)
+ (poke-setting-set-oindent (widget-value widget))
+ (setq poke-setting-oindent (widget-value widget))))
+ (widget-insert "\n")
;; XXX oacutoff
;; XXX odepth
- ;; XXX oindent
(use-local-map poke-settings-map)
(widget-setup))