all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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

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

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.