[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

transparent access to zsh shell functions and aliases; and, the Emacs/tt

From: Emanuel Berg
Subject: transparent access to zsh shell functions and aliases; and, the Emacs/tty/X clipboard issue
Date: Thu, 17 Apr 2014 10:53:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

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

(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 ()
  (shell-command "xsel --display \":0\" -b -o" 1) ; 1 = output at point
  (goto-char (mark)) )

(defun set-X-clipboard ()
  (let ((input (if mark-active
                (current-kill 0 t)) ))) ; most recent kill; don't pop
     (format "echo -n '%s' | xsel --display \":0\" -b -i" input) )))

(defalias 'pst 'insert-X-clipboard)
(defalias 'cpy 'set-X-clipboard)

underground experts united:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]