[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-numbers f48504348f 121/145: Add evil-numbers-case opt
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-numbers f48504348f 121/145: Add evil-numbers-case option |
Date: |
Thu, 6 Jan 2022 03:00:24 -0500 (EST) |
branch: elpa/evil-numbers
commit f48504348f4d021a81aaa6190b65b8c4ea62ace8
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Add evil-numbers-case option
Allow setting the default case for hexadecimal values.
---
CHANGELOG.org | 4 ++++
README.org | 8 ++++++++
evil-numbers.el | 21 +++++++++++++++++++--
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.org b/CHANGELOG.org
index ee6ff741d5..841450d480 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -2,6 +2,10 @@
* In Development
+** Additions
+
++ Add =evil-numbers-case= option for the case to use for hexadecimal values
(defaults to the current case).
+
** Fixes
+ Fix #24 hexadecimal values case changes when incrementing/decrementing.
diff --git a/README.org b/README.org
index bc33334e04..86fe5641c0 100644
--- a/README.org
+++ b/README.org
@@ -35,6 +35,14 @@
Set to =t= if you want numbers to be padded with zeros (numbers with a
leading zero are always padded).
If you want both behaviors, all commands take an optional argument
=padded=.
+ - =evil-numbers-case=
+
+ The case to use for hexadecimal numbers.
+
+ - =nil= Current case (default).
+ - '=upcase= Always upper case.
+ - '=downcase= Always lower case.
+
** Key Bindings
Example key bindings:
diff --git a/evil-numbers.el b/evil-numbers.el
index 62b9e8decb..a4fadf5058 100644
--- a/evil-numbers.el
+++ b/evil-numbers.el
@@ -80,6 +80,15 @@
:type 'boolean
:options '(nil t))
+(defcustom evil-numbers-case nil
+ "Case to use for hexadecimal numbers."
+ :group 'evil-numbers
+ :type
+ '(choice
+ (const :tag "Current Case" nil)
+ (const :tag "Upper Case" upcase)
+ (const :tag "Lower Case" downcase)))
+
;; ---------------------------------------------------------------------------
;; Internal Variables
@@ -328,8 +337,16 @@ replace number incremented by AMOUNT in BASE and return
non-nil."
;; Maintain case.
(when do-case
- (when (eq -1 (or (evil-numbers--case-category str-prev -1) -1))
- (setq str-next (downcase str-next))))
+ (cond
+ ;; Upper case (already set).
+ ((eq evil-numbers-case 'upcase)
+ nil)
+ ((eq evil-numbers-case 'downcase)
+ (setq str-next (downcase str-next)))
+ ;; Keep current case.
+ (t
+ (when (eq -1 (or (evil-numbers--case-category str-prev -1) -1))
+ (setq str-next (downcase str-next))))))
;; Replace the sign (as needed).
(cond
- [nongnu] elpa/evil-numbers a427fda95e 111/145: Update README.org, (continued)
- [nongnu] elpa/evil-numbers a427fda95e 111/145: Update README.org, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers a01fa6b83a 106/145: Rename evil-numbers/padDefault to evil-numbers-pad-default, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 01c68921b5 114/145: README.org: update keymap examples, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 8d84bd3763 108/145: Cleanup: remove strict number searching logic, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers a65dbc5094 123/145: Cleanup: remove nil for empty body, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers bce451b700 137/145: Use message instead of error when no number is found, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 6087ef48b9 140/145: Tests: run increment operations at different offsets, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 8ce0066fa4 143/145: Tests: rename evil-numbers-test.el to evil-numbers-tests.el, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers d7a3e6ddec 129/145: Add evil to requirements, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 11883bc3a3 124/145: Fix incremental regression in cleanup from 7602f3b4842f4ec149d3b8ed32c9da9f771597c3, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers f48504348f 121/145: Add evil-numbers-case option,
ELPA Syncer <=
- [nongnu] elpa/evil-numbers 6ff686be13 120/145: Cleanup: remove autoload on defcustom, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 9423e4cb8f 142/145: Tests: add simple-hex-negative-to-positive, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 8761f55167 144/145: Cleanup: redundant group usage, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 061de6f895 139/145: Tests: watch evil-numbers.el as well as the tests, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers b2e8ac003f 023/145: Fix install documentation., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers afbc461412 014/145: Tag version 0.1, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers b87c8b735c 098/145: Use ORG mode for the CHANGELOG, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-numbers 1ed882ca9f 011/145: Add docs., ELPA Syncer, 2022/01/06