* transparent access to zsh shell functions and aliases; and, the Emacs/tty/X clipboard issue
@ 2014-04-17 8:53 Emanuel Berg
0 siblings, 0 replies; 3+ messages in thread
From: Emanuel Berg @ 2014-04-17 8:53 UTC (permalink / raw)
To: help-gnu-emacs
Been away from the game a long time. People say Emacs
changed - they want to know what I think about
it. Truth told, suffered from self-doubt. Had to prove
I still had it. If I succeeded? Y'know what they say:
in hacking, the *fans* are the judges. But seems to me,
since I left ain't too much changed.
1. Transparent access to zsh aliases and functions from
Emacs, having them at one place (or places, if you make
calls form ~/.zshenv) - point is, same place for zsh
and Emacs so no multiple definitions that may get out of
synch.
(defun emacs-or-shell-cmd (command-name)
(interactive "s command: ")
(if (commandp (intern command-name))
(execute-extended-command current-prefix-arg command-name)
(shell-command command-name 1) ))
;; in ~/.zshenv, put
;; say_hello () { echo hello }
;; alias shut='shutdown -h now -F'
(global-set-key (kbd "M-a") 'emacs-or-shell-cmd)
2. Emacs tty/X clipboard finally working - if you
remember this issue - the key was to use 'xsel', not
'xclip'. Contrary to 'xclip', you'll have to get 'xsel'
from the repos.
(defun insert-X-clipboard ()
(interactive)
(shell-command "xsel --display \":0\" -b -o" 1) ; 1 = output at point
(goto-char (mark)) )
(defun set-X-clipboard ()
(interactive)
(let ((input (if mark-active
(buffer-substring-no-properties
(region-beginning)
(region-end))
(string-make-unibyte
(current-kill 0 t)) ))) ; most recent kill; don't pop
(shell-command
(format "echo -n '%s' | xsel --display \":0\" -b -i" input) )))
(defalias 'pst 'insert-X-clipboard)
(defalias 'cpy 'set-X-clipboard)
--
underground experts united:
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: transparent access to zsh shell functions and aliases; and, the Emacs/tty/X clipboard issue
[not found] <540883CA.6020206@hds.com>
@ 2014-09-04 19:21 ` Emanuel Berg
[not found] ` <54096580.5020300@hds.com>
0 siblings, 1 reply; 3+ messages in thread
From: Emanuel Berg @ 2014-09-04 19:21 UTC (permalink / raw)
To: help-gnu-emacs
Graeme Vetterlein <graeme.vetterlein@hds.com> writes:
> I think you need to escape the quotes (BTW, I don't
> know lisp, I guessed and it worked) if the text being
> cut has meta characters
>
> (format "echo -n \'%s\' | Xsel --display \":0\" -b
> -i" input) )))
>
>
> here ----> \'%s\'
Did you intend this as a private mail or for the
list/newsgroup? It doesn't contain anything sensitive
which is why I send this reply, and your fix (quoted),
to gnu.emacs.help.
I don't really remember the issue back then, so either
I dropped it or got it to work :) But thanks!
Here are the related files, which are probably better
as I have used them more:
http://user.it.uu.se/~embe8573/conf/emacs-init/linux-shell.el
http://user.it.uu.se/~embe8573/conf/emacs-init/xsel.el
--
underground experts united
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: transparent access to zsh shell functions and aliases; and, the Emacs/tty/X clipboard issue
[not found] ` <54096580.5020300@hds.com>
@ 2014-09-05 20:37 ` Emanuel Berg
0 siblings, 0 replies; 3+ messages in thread
From: Emanuel Berg @ 2014-09-05 20:37 UTC (permalink / raw)
To: help-gnu-emacs
Graeme Vetterlein <graeme.vetterlein@hds.com> writes:
> Thanks for the *.el
I forgot, it also relies on the xo and xi in this file
for zsh:
http://user.it.uu.se/~embe8573/conf/.zsh/x
And the "scroll/copy mode" part of this file, for tmux:
http://user.it.uu.se/~embe8573/conf/.tmux.conf
> BTW... I assume you bind these to some keys? ... Which
> ones did you use?
In general you assume correctly as I always want
everything shortcutted. Tho I don't think M-x is bad
(at all), and certainly one thousand times better than
the mouse, I think shortcuts are superior and
especially for editing commands.
However, in this case - I did all that that several
years ago, when I had just discovered Emacs.
At that time I didn't know of Rmail or Gnus, and not of
Emacs-W3M (or any other browser for Emacs). I did know
of Usenet, but I thought it was dead. So I still relied
on X do to mail, browsing, and technology discussion...
But even then I wanted to do everything in Emacs (to
have a uniform, programmable interface). So I tried
various ways to bridge the gap between Emacs and the
X/GUI applications. This is part of that project.
In time, I discovered all the other in-Emacs solutions
and gradually moved over to them, so those clever
schemes lost their allure. But I still use them, but
now seldom and almost always from another tty (with
tmux/zsh) into Emacs.
So long story short (?) today I use them so seldom the
meta-exes of xsel.el, namely
(defalias 'pst 'insert-X-clipboard)
(defalias 'xo 'insert-X-clipboard)
(defalias 'xi 'set-X-clipboard)
(defalias 'cpy' 'set-X-clipboard)
are fast enough :)
--
underground experts united
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-05 20:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <540883CA.6020206@hds.com>
2014-09-04 19:21 ` transparent access to zsh shell functions and aliases; and, the Emacs/tty/X clipboard issue Emanuel Berg
[not found] ` <54096580.5020300@hds.com>
2014-09-05 20:37 ` Emanuel Berg
2014-04-17 8:53 Emanuel Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).