emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FW: calc-yank.el


From: Kaushal Modi
Subject: Re: FW: calc-yank.el
Date: Wed, 11 Jan 2017 03:52:22 +0000

Hi Kevin,

Can you please provide a git formatted patch with respect to the master branch?

I expanded the calc-yank function last year to support  different radixes: http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=ec0d4d24fd11b5040de9f7657b486c3b1e743071


On Tue, Jan 10, 2017, 10:36 PM Driscoll, Kevin R <address@hidden> wrote:
Contrary to the header of the calc-yank.el file, jay.p.belanger is no longer the maintainer of calc-yank.
This should be updated.  And, please consider my change suggestion below.

-----Original Message-----
From: Jay Belanger [mailto:address@hidden]
Sent: Tuesday, January 03, 2017 14:53
To: Driscoll, Kevin R <address@hidden>
Subject: Re: calc-yank.el

Hi Kevin,

I'm a little surprised that digit-grouped numbers aren't handled properly already.  But your solution looks well thought out.
However, I'm not using Emacs or maintaining Calc any more.
You should send this to address@hidden, and they should make the changes.

Jay

-----Original Message-----
To: Jay Belanger [mailto:address@hidden]
From: Driscoll, Kevin R <address@hidden>
Subject: Re: calc-yank.el

Please consider the changes to calc-yank.el between the commented lines below.   This allows the yanking of digit-grouped numbers.  It’s a real pain not having that capability, given that most large numbers to be imported into calc from text are grouped.  While this could interfere with yanking vectors, the grabs are actually simpler alternatives for vectors.  To minimize the impact of this change on the unsuspecting, a nil-default calc-yank-grouped mode flag could be added and the ‘’calc-group-digits’’ below could be replaced with “calc-yank-grouped” or “(and calc-group-digits calc-yank-grouped)”.  This doesn’t handle radix > 10; yanking these are very rare for grouped numbers and there’s not a standard format (16# vs 0x).

(defun calc-yank ()
  (interactive)
  (calc-wrapper
   (calc-pop-push-record-list
    0 "yank"
    (let ((thing (if (fboundp 'current-kill)
                                     (current-kill 0 t)
                                   (car kill-ring-yank-pointer))))
      (if (eq (car-safe calc-last-kill) thing)
                  (cdr calc-last-kill)
                (if (stringp thing)
;                   (let ((val (math-read-exprs (calc-clean-newlines thing))))
                    (let ((val (math-read-exprs
                        (calc-clean-newlines
                         (if calc-group-digits
                             (replace-regexp-in-string
                              (concat "\\([0-9]\\)" calc-group-char
"\\([0-9]\
\)")
                              "\\1\\2"
                              thing)
                           thing)))))
;
                      (if (eq (car-safe val) 'error)
                                  (progn
                                    (setq val (math-read-exprs thing))
                                    (if (eq (car-safe val) 'error)
                                                (error "Bad format in
yanked
data")
                                      val))
                                val))))))))

--
Kevin R. Driscoll, Engineering Fellow          address@hidden
Phone: +1 763-954-6789      Cell: +1 612-801-9520       FAX: +1 763-954-5473
Honeywell; MN10-122B; 1985 Douglas Dr. N.; Golden Valley; MN
55422-3992; USA
--

Kaushal Modi


reply via email to

[Prev in Thread] Current Thread [Next in Thread]