all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <87k3aoqqvl.fsf@nl106-137-194.student.uu.se> (raw)

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


             reply	other threads:[~2014-04-17  8:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-17  8:53 Emanuel Berg [this message]
     [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

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=87k3aoqqvl.fsf@nl106-137-194.student.uu.se \
    --to=embe8573@student.uu.se \
    --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.