GNU bug report logs -
#24612
26.0.50; calc: insertion/deletion of chars not at point in calc minibuffer
Previous Next
Reported by: Tino Calancha <tino.calancha <at> gmail.com>
Date: Tue, 4 Oct 2016 11:33:01 UTC
Severity: minor
Tags: fixed, patch
Found in version 26.0.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24612 in the body.
You can then email your comments to 24612 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24612
; Package
emacs
.
(Tue, 04 Oct 2016 11:33:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Tino Calancha <tino.calancha <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 04 Oct 2016 11:33:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
It is very counter-intuitive how to modify things in the calc minibuffer.
Insertions and deletions are respect to the digit in the right hand side.
You can set the point before any digit, but <backspace> will always delete
the last one.
emacs -Q
M-x calc RET
9123
I) C-a C-d ; Delete 3 instead of 9, number:912
II) C-b C-b; Point is right after 9.
III) <backspace> ; Delete 2 instead of 9, number: 91
IV) C-a 8 ; Number: 918 instead of 891.
I find easier if the behaviour is as follows:
M-x calc RET
9123
I) C-a C-d ; number: 123
II) C-e C-b ; Point is right after 2.
III) <backspace> ; number: 13
IV) C-a 8 ; number: 813
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From fc4ac0c2a32ebb771583514dc6519539eaa9ac9b Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha <at> gmail.com>
Date: Tue, 4 Oct 2016 20:23:29 +0900
Subject: [PATCH] calc: insert/delete chars in calc minibuffer at point
* lisp/calc/calc.el (calcDigit-delchar): New command to delete chars
forward in the calc minibuffer.
(calc-digit-map): Bind calcDigit-delchar to '\C-d'.
(calcDigit-key): Do not go to (point-max) in calc minibuffer
before insert a digit (Bug#24612).
---
lisp/calc/calc.el | 50 ++++++++++++++++++++++++++++++++++++--------------
1 file changed, 36 insertions(+), 14 deletions(-)
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 7ae8fdf..c230ed9 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -1120,8 +1120,26 @@ calc-digit-map
(append (where-is-internal 'delete-backward-char global-map)
(where-is-internal 'backward-delete-char global-map)
(where-is-internal 'backward-delete-char-untabify global-map)
- '("\C-d"))
- '("\177" "\C-d")))
+ '("\177"))
+ '("\177")))
+
+(mapc (lambda (x)
+ (ignore-errors
+ (define-key calc-digit-map x 'calcDigit-delchar)
+ (define-key calc-mode-map x 'calc-pop)
+ (define-key calc-mode-map
+ (if (and (vectorp x) (featurep 'xemacs))
+ (if (= (length x) 1)
+ (vector (if (consp (aref x 0))
+ (cons 'meta (aref x 0))
+ (list 'meta (aref x 0))))
+ "\e\C-d")
+ (vconcat "\e" x))
+ 'calc-pop-above)))
+ (if calc-scan-for-dels
+ (append (where-is-internal 'delete-forward-char global-map)
+ '("\C-d"))
+ '("\C-d")))
(defvar calc-dispatch-map
(let ((map (make-keymap)))
@@ -2383,7 +2401,6 @@ calc-minibuffer-contains
(defun calcDigit-key ()
(interactive)
- (goto-char (point-max))
(if (or (and (memq last-command-event '(?+ ?-))
(> (buffer-size) 0)
(/= (preceding-char) ?e))
@@ -2426,8 +2443,7 @@ calcDigit-key
(delete-char 1))
(if (looking-at "-")
(delete-char 1)
- (insert "-")))
- (goto-char (point-max)))
+ (insert "-"))))
((eq last-command-event ?p)
(if (or (calc-minibuffer-contains ".*\\+/-.*")
(calc-minibuffer-contains ".*mod.*")
@@ -2480,17 +2496,9 @@ calcDigit-key
(setq calc-prev-prev-char calc-prev-char
calc-prev-char last-command-event))
-
(defun calcDigit-backspace ()
(interactive)
- (goto-char (point-max))
- (cond ((calc-minibuffer-contains ".* \\+/- \\'")
- (backward-delete-char 5))
- ((calc-minibuffer-contains ".* mod \\'")
- (backward-delete-char 5))
- ((calc-minibuffer-contains ".* \\'")
- (backward-delete-char 2))
- ((eq last-command 'calcDigit-start)
+ (cond ((eq last-command 'calcDigit-start)
(erase-buffer))
(t (backward-delete-char 1)))
(if (= (calc-minibuffer-size) 0)
@@ -2499,6 +2507,20 @@ calcDigit-backspace
(calcDigit-nondigit))))
+(defun calcDigit-delchar ()
+ (interactive)
+ (cond ((looking-at-p " \\+/- \\'")
+ (delete-char 5))
+ ((looking-at-p " mod \\'")
+ (delete-char 5))
+ ((looking-at-p " \\'")
+ (delete-char 2))
+ ((eq last-command 'calcDigit-start)
+ (erase-buffer))
+ (t (unless (eobp) (delete-char 1))))
+ (when (= (calc-minibuffer-size) 0)
+ (setq last-command-event 13)
+ (calcDigit-nondigit)))
(defconst math-bignum-digit-length
--
2.9.3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 26.0.50.4 (x86_64-pc-linux-gnu, GTK+ Version 3.22.0)
of 2016-10-04 built on calancha-pc
Repository revision: e2913dc880b9843bf69cf885270551bafeb46120
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24612
; Package
emacs
.
(Tue, 25 Jun 2019 00:01:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 24612 <at> debbugs.gnu.org (full text, mbox):
Tino Calancha <tino.calancha <at> gmail.com> writes:
> It is very counter-intuitive how to modify things in the calc minibuffer.
> Insertions and deletions are respect to the digit in the right hand side.
> You can set the point before any digit, but <backspace> will always delete
> the last one.
>
> emacs -Q
>
> M-x calc RET
> 9123
> I) C-a C-d ; Delete 3 instead of 9, number:912
> II) C-b C-b; Point is right after 9.
> III) <backspace> ; Delete 2 instead of 9, number: 91
> IV) C-a 8 ; Number: 918 instead of 891.
Yes, that's supremely confusing. I don't think anything else in Emacs
works this way?
> I find easier if the behaviour is as follows:
> M-x calc RET
> 9123
> I) C-a C-d ; number: 123
> II) C-e C-b ; Point is right after 2.
> III) <backspace> ; number: 13
> IV) C-a 8 ; number: 813
I think I) here sounds a bit unusual, too. Wouldn't it be better if
that just gave an error as normal?
But, anyway, I'm guessing this behavior is on purpose. I'm not a calc
user, but is there anybody here who are? And are attached to the
current way this works?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#24612
; Package
emacs
.
(Tue, 11 Aug 2020 13:43:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 24612 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>> emacs -Q
>>
>> M-x calc RET
>> 9123
>> I) C-a C-d ; Delete 3 instead of 9, number:912
>> II) C-b C-b; Point is right after 9.
>> III) <backspace> ; Delete 2 instead of 9, number: 91
>> IV) C-a 8 ; Number: 918 instead of 891.
[...]
> But, anyway, I'm guessing this behavior is on purpose. I'm not a calc
> user, but is there anybody here who are? And are attached to the
> current way this works?
I went ahead and applied the patch to Emacs 28, but if there's any
complaints, I guess we should revert it. The new behaviour sounds a lot
less confusing than the old one, though, but I'm not a regular Calc
user.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 11 Aug 2020 13:43:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 28.1, send any further explanations to
24612 <at> debbugs.gnu.org and Tino Calancha <tino.calancha <at> gmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 11 Aug 2020 13:43:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 09 Sep 2020 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 228 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.