[Top][All Lists]

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

Re: [Orgmode] OT: remember'ing from other programs with stumpwm

From: Dmitri Minaev
Subject: Re: [Orgmode] OT: remember'ing from other programs with stumpwm
Date: Fri, 6 Jul 2007 11:17:05 +0500

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
(defun get-clipboard-selection ()
 "Retrieve text from clipboard selection and strip all its properties"
 (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"
 (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)) 
   (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
** 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.)
** 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:


  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

reply via email to

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