From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dmitri Minaev" Subject: Re: OT: remember'ing from other programs with stumpwm Date: Fri, 6 Jul 2007 11:17:05 +0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I6h7t-00079s-4Z for emacs-orgmode@gnu.org; Fri, 06 Jul 2007 02:17:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I6h7s-00078V-9a for emacs-orgmode@gnu.org; Fri, 06 Jul 2007 02:17:08 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I6h7s-000781-1L for emacs-orgmode@gnu.org; Fri, 06 Jul 2007 02:17:08 -0400 Received: from wx-out-0506.google.com ([66.249.82.236]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I6h7r-0002Ia-Mr for emacs-orgmode@gnu.org; Fri, 06 Jul 2007 02:17:07 -0400 Received: by wx-out-0506.google.com with SMTP id s7so112579wxc for ; Thu, 05 Jul 2007 23:17:06 -0700 (PDT) In-Reply-To: Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org > Yes, something like this. Unfortunately, C-c copies the text into the > clipboard, and Emacs pastes the content of the primary selection. And > I'm afraid that Conkeror also uses the clipboard selection. I want to > try and play with xclipboard or xselection, but I'm a bit skeptical > about both of them. I think I did it :). Instead of xselection (which might give suitable results) I used elisp functions. First, I added two functions to ~/.emacs: (defun get-clipboard-selection () "Retrieve text from clipboard selection and strip all its properties" (interactive) (let ((str (x-get-selection 'CLIPBOARD))) (set-text-properties 0 (length str) nil str) (insert str))) (defun get-primary-selection () "Retrieve text from primary selection and strip all its properties" (interactive) (let ((str (x-get-selection 'PRIMARY))) (set-text-properties 0 (length str) nil str) (insert str))) they should be one function, I know... The remember template is: (setq org-remember-templates '((?t "* TODO %?\n %i\n %a" "~/org/notes.org") (?f "%i\n %?" "~/org/notes.org"))) The function in ~/.stumpwmrc is now: (define-stumpwm-command "emacs-remember" () (let ((current-window-name (if (current-window) (window-title (current-window)) "No current window")) (copy-from-firefox (equal (window-class (current-window)) "Firefox-bin"))) (when copy-from-firefox (send-meta-key (current-screen) (kbd "C-l")) (send-meta-key (current-screen) (kbd "C-c"))) (run-or-raise "emacs" :class "Emacs") (send-meta-key (current-screen) (kbd "M-x")) (window-send-string (current-window) "org-remember") (send-meta-key (current-screen) (kbd "RET")) (window-send-string (current-window) "f") (window-send-string (current-window) current-window-name) (send-meta-key (current-screen) (kbd "RET")) (send-meta-key (current-screen) (kbd "M-x")) (window-send-string (current-window) "get-primary-selection") (send-meta-key (current-screen) (kbd "RET")) (send-meta-key (current-screen) (kbd "RET")) (when copy-from-firefox (send-meta-key (current-screen) (kbd "M-x")) (window-send-string (current-window) "get-clipboard-selection") (send-meta-key (current-screen) (kbd "RET"))))) (define-key *top-map* (kbd "F12") "emacs-remember") A bit awkward, but I like the result. Now, we can select the text in any window using mouse (which is against stumpwm ideology :)), press F12 and we get the Remember buffer. After C-u C-c C-c, the following entries appear in the default notes file (the first entry is from Firefox, the second is from kpdf and the third one is from Thunderbird): ** Fri Jul 6 10:33:30 2007 ( The Epoch Times | Earliest Findings of Wooden Figurines in ) The Epoch Times | Earliest Findings of Wooden Figurines in China - Mozilla Firefox Recently, a Chinese archaeological team working in Hanchen City, Shaanxi Province, excavated an ancient tomb from the Zhou Dynasty ((1046-221 B.C.) and discovered many precious historical relics. Inside one chamber they found four wooden figurines with color painted design. To this day, these figurines are the earliest known in China. They have been dated 500 years older than the terracotta soldiers and horses of the Qin Dynasty (221-205 B.C.) http://en.epochtimes.com/news/7-6-25/56866.html ** Fri Jul 6 10:37:43 2007 ( elisp-intro.pdf - KPDF) elisp-intro.pdf - KPDF Most of the GNU Emacs integrated environment is written in the pro- gramming language called Emacs Lisp. The code written in this program- ming language is the software?the sets of instructions?that tell the com- puter what to do when you give it commands. Emacs is designed so that you can write new code in Emacs Lisp and easily install it as an extension to the editor. ** Fri Jul 6 10:40:04 2007 ( [CLASSICS-L] For users of TeX - Thunderbird) [CLASSICS-L] For users of TeX - Thunderbird Technica, a suite of LaTeX packages for typesetting literary texts, is available on CTAN: http://www.ctan.org/tex-archive/macros/latex/contrib/technica/ The `examples' directory holds nearly 100,000 lines of texts in seven languages, including Greek and Latin. What I miss now is the ability to store links to the messages in the Thunderbird folders, but I, probably, want too much :) -- With best regards, Dmitri Minaev Russian history blog: http://minaev.blogspot.com