emacs-devel
[Top][All Lists]
Advanced

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

FW: calc-yank.el


From: Driscoll, Kevin R
Subject: FW: calc-yank.el
Date: Tue, 10 Jan 2017 23:49:47 +0000

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

reply via email to

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