[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need help with emacs clipboard.
Re: Need help with emacs clipboard.
Wed, 14 Jan 2015 13:46:10 -0700
Harry Putnam wrote:
> Bob Proulx writes:
> > This won't help you because you want the opposite but just to post my
> > example this is what I do to configure emacs to be usable on the X
> > desktop using the primary selection.
> > (setq transient-mark-mode nil)
> > (setq select-active-regions nil) ; default is nil in 23, t in 24
> > (setq mouse-drag-copy-region t) ; default is t in 23, nil in 24
> > (setq x-select-enable-primary t) ; default is nil in 23, t in 24
> > (setq x-select-enable-clipboard nil) ; default is nil in 23, t in 24
> > (setq x-select-enable-clipboard-manager nil) ; new in 24, default is t
> Bob, just slipped in here to see if I could get you to show how to put
> all that into a single statement that does all those things with one
I am sorry but there isn't one. If you want each of those items then
you need each of those items.
> I'm thinking to be able to turn it off and on quickly.
This isn't something you would turn on and off. Why does it need to
be one single statement? It isn't something one puts on a command
line command. It is a part of a much larger configuration. This
configuration normally goes into your emacs config, traditionally your
~/.emacs file although now available to configure other places too.
It doesn't make any sense to change this while the emacs is running.
I can't imagine a need for it but to turn this into an interactively
callable function it would be something like this:
(defun my-set-modes ()
"Set my modes."
(setq transient-mark-mode nil)
(setq select-active-regions nil)
(setq mouse-drag-copy-region t)
(setq x-select-enable-primary t)
(setq x-select-enable-clipboard nil)
(setq x-select-enable-clipboard-manager nil))
Then you could call it with M-x my-set-modes. But I don't think it is
a useful thing as a function like that. I will leave it to the reader
to create the opposite function to set the opposite values for those.
I am not recommending any of this but simply providing it because you
asked for it specifically.
> Sorry I'm so horribly lazy but staggering around with that has
> resulted in a visit to the emergency room for paren-mania. They only
> had one real treatment that worked... lots of morphine.
I am not sure there is a cure for paren-mania. However I think
morphine is the wrong cure. Instead I suggest sunshine and a good
fiction novel in the park. Computers are here to help us. If working
at the computer isn't a help then time to get away and do something
Emacs is programmed with lisp and lisp, along with many other
languages, uses one set of parens per function call. Most languages
use one set of parens per function all. Ruby and Python are eschewing
parens these days but I still like them. They make it easy for me to
see and delineate functions calls.
Lisp is on the other side of the syntax from C languages. Instead of
calling a function foo(param) like it does in C in lisp the function
is called (foo parm). That first parentheses is what starts the
function call and not what starts the argument list. A very tiny
But then there is the named variable too. Basically in a C language
the first parameter is the first parameter and the second is the
second and so forth. In Ruby and Python it is more typical to name
them so that we can order them differently. Maybe instead of having
twenty parameters only give the ones that are different from the
default value. Where do you think Ruby and Python got that paradigm
from? They got it from lisp where it is typical to name parameters.
Therefore (setq x-select-enable-primary t) in a C language would be
set_x_select_enable_primary(t). Something like that would work and
does in C all of the time. But in lisp it is easier and simply to
have a generic setter function like setq (short for set the params
quoted literally) and then pass in both the name of the variable and
the value of the variable and have it set it. And so we have things
like (setq x-select-enable-primary t). It isn't really that much
different from saying X_SELECT_ENABLE_PRIMARY=true if it were written
in shell code for example. Or was a windows .ini format file. Or
many other possibilties.
No need for paren-noia. Simply divide and conquer. Break down the
characters into sets of things. Understand each part individually.
It all makes sense and isn't so bad. Really! :-)