all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Driscoll, Kevin R" <kevin.driscoll@honeywell.com>
To: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: FW: calc-yank.el
Date: Tue, 10 Jan 2017 23:49:47 +0000	[thread overview]
Message-ID: <DM2PR0701MB13112B9D9150F6321B036A5883670@DM2PR0701MB1311.namprd07.prod.outlook.com> (raw)
In-Reply-To: <20170103205239.GA5869@belanger-laptop>

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:jay.p.belanger@gmail.com] 
Sent: Tuesday, January 03, 2017 14:53
To: Driscoll, Kevin R <kevin.driscoll@honeywell.com>
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 emacs-devel@gnu.org, and they should make the changes.

Jay

-----Original Message-----
To: Jay Belanger [mailto:jay.p.belanger@gmail.com]
From: Driscoll, Kevin R <kevin.driscoll@honeywell.com>
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           Kevin.Driscoll@Honeywell.com
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	other threads:[~2017-01-10 23:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DM2PR0701MB1311E97560FC2F28BCDA0917836E0@DM2PR0701MB1311.namprd07.prod.outlook.com>
     [not found] ` <20170103205239.GA5869@belanger-laptop>
2017-01-10 23:49   ` Driscoll, Kevin R [this message]
2017-01-11  3:52     ` FW: calc-yank.el Kaushal Modi
2017-01-11  8:35       ` Bastian Beischer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM2PR0701MB13112B9D9150F6321B036A5883670@DM2PR0701MB1311.namprd07.prod.outlook.com \
    --to=kevin.driscoll@honeywell.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.