I wrote a function that pastes in the currently selected color from the palette to the buffer:
(defun palette-paste-in-current-color ()
(interactive)
(cua-paste (palette-current-rgb-to-kill-ring)))
I wrote a function that calls the palette from the current content of the kill ring (RGB content):
(defun palette-launch-from-kill-ring ()
(interactive)
(palette (concat "#" (substring-no-properties (car kill-ring)))))
I thought it would be handy to just move the point to an rgb color in a buffer, then use expand-region
followed by cua-copy-region
to automate the process. So I wrote:
(defun palette-launch-from-kill-ring ()
(interactive)
(er/expand-region)
(cua-copy-region)
(palette (concat "#" (substring-no-properties (car kill-ring)))))
But I get an error and I am puzzled on how to run these functions one after another successfully.
EDIT:
The error I get is (can't decipher what is going on here):
apply: Wrong number of arguments: #[(ad--addoit-function arg) "Ä Å
!)" [ad-return-value rectangular-region-mode ad--addoit-function arg nil rrm/switch-to-multiple-cursors] 3], 1
mark-active
. More importantly, you should not need to use the kill ring at all, here (unless you really need to have such text on it, for some other use later). Just pass the text of the region around where you need it:buffer-substring
,region-beginning
,region-end
. – Drew Nov 26 '16 at 0:38mark-active
. I probably should just learn elisp properly! – Damian Chrzanowski Nov 26 '16 at 8:17