all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bob Proulx <bob@proulx.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Need help with emacs clipboard.
Date: Wed, 14 Jan 2015 13:46:10 -0700	[thread overview]
Message-ID: <20150114125645795909310@bob.proulx.com> (raw)
In-Reply-To: <87egqxb9q0.fsf@reader.local.lan>

Hi Harry,

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
> command.

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."
  (interactive)
  (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
completely different.

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
difference.

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! :-)

Bob



  reply	other threads:[~2015-01-14 20:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13  2:47 Need help with emacs clipboard cplum984
2015-01-14  4:46 ` Bob Proulx
2015-01-14 16:36   ` Harry Putnam
2015-01-14 20:46     ` Bob Proulx [this message]
2015-01-15 20:50       ` Harry Putnam
     [not found]       ` <mailman.17973.1421355042.1147.help-gnu-emacs@gnu.org>
2015-01-15 21:05         ` Joost Kremers
2015-01-25 22:53   ` Robert Thorpe
2015-01-31  3:18     ` Bob Proulx
2015-01-31 19:02       ` Robert Thorpe
2015-02-01  4:45         ` Bob Proulx
2015-02-01 13:53           ` Robert Thorpe

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=20150114125645795909310@bob.proulx.com \
    --to=bob@proulx.com \
    --cc=help-gnu-emacs@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.