Scheme, Clojure, Common Lisp, Guile, etc. On Tue, May 17, 2016 at 9:25 AM, <stumpwm-devel-requ...@nongnu.org> wrote:
> Send Stumpwm-devel mailing list submissions to > stumpwm-devel@nongnu.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.nongnu.org/mailman/listinfo/stumpwm-devel > or, via email, send a message with subject or body 'help' to > stumpwm-devel-requ...@nongnu.org > > You can reach the person managing the list at > stumpwm-devel-ow...@nongnu.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Stumpwm-devel digest..." > > > Today's Topics: > > 1. Re: Stump, Emacs and X selection. (Milan Zamazal) > 2. Re: Stump, Emacs and X selection. (David Bjergaard) > 3. Re: Stump, Emacs and X selection. (Dimitri Minaev) > 4. Re: Stump, Emacs and X selection. (Dimitri Minaev) > 5. Re: Stump, Emacs and X selection. (David Bjergaard) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 13 May 2016 20:11:01 +0200 > From: Milan Zamazal <p...@zamazal.org> > To: stumpwm-devel@nongnu.org > Subject: Re: [STUMP] Stump, Emacs and X selection. > Message-ID: <87zirthlqi....@zamazal.org> > Content-Type: text/plain > > >>>>> "DM" == Dimitri Minaev <min...@gmail.com> writes: > > DM> that would create a note in Org-mode and paste the current > DM> selection and some other info taken from Firefox -- the URL and > DM> the tab title. > > Off-topic, but maybe still useful for someone here: This can be done > without StumpWM, just with Emacs and Firefox: > > https://github.com/alphapapa/org-protocol-capture-html > > > > > > ------------------------------ > > Message: 2 > Date: Mon, 16 May 2016 13:59:22 -0400 > From: David Bjergaard <dbjerga...@gmail.com> > To: Dimitri Minaev <min...@gmail.com> > Cc: Dany Haddad <danyhadda...@gmail.com>, "stumpwm-devel\@nongnu.org > " > <stumpwm-devel@nongnu.org> > Subject: Re: [STUMP] Stump, Emacs and X selection. > Message-ID: <87mvnpdgud....@gmail.com> > Content-Type: text/plain > > Hi Dimitri, > > I'm not sure why you have to run it twice. I tried the snippet, and I > didn't > see the text pop up until the second time I wrote it. As for dropping > non-latin > characters: this is a known issue with StumpWM, and one that I'm slowly > trying > to address. > > If you can get the bugs worked out (or not) you should put this on the wiki > since its a great example of using stumpwm to automate window actions that > may > be tedious. > > David > > Dimitri Minaev <min...@gmail.com> writes: > > > Ah, that `setf'... :) It was just a leftover of one of my panicky > > experiments when I tried to get rid of all possible delayed > > evaluations. > > > > On 13 May 2016 at 21:12, Dany Haddad <danyhadda...@gmail.com> wrote: > >> Dimitri, > >> > >> Cool snippet! > >> > >> I have not tried to run your code, but just looking over it brielfy: > >> - Why are you setting `sel` in the `let` expression and immediately > after > >> using `setf`? > >> - I believe copy-seq does a shallow copy, so the elements will still be > >> aliased, causing `quantum entanglement` > >> - I haven't looked into the `get-x-selection` routine, but it could be > >> stateful. Try looking into the source and maybe doing a deep copy on its > >> return value. > >> > >> Hope that helps! > >> > >> Dany > >> > >> On Fri, May 13, 2016 at 5:23 AM Patricio Martinez <maxx...@gmail.com> > wrote: > >>> > >>> Amazing, I'll probe it soon and I'll see how work. > >>> > >>> Thank you very much > >>> > >>> Sent from Nylas N1, the extensible, open source mail client. > >>> On may. 13 2016, at 1:27 pm, Dimitri Minaev <min...@gmail.com> wrote: > >>>> > >>>> Hello, > >>>> > >>>> I'm trying to write a Stumpwm command that would create a note in > >>>> Org-mode and paste the current selection and some other info taken > >>>> from Firefox -- the URL and the tab title. While trying to implement > >>>> the command I met a couple of problems. > >>>> > >>>> First, it doesn't work with non-Latin characters. I'm not sure whether > >>>> this is related to Stumpwm or Emacs. Stump's get-x-selection yields > >>>> correct result, but window-send-string seemingly drops all Cyrillic > >>>> characters from that string. > >>>> > >>>> Then the other problem appeared. To avoid confusion between the > >>>> primary selection and the URL, I save the selection content in a > >>>> variable before putting the URL to another variable, but it seems that > >>>> these two variables are in the state of quantum entanglement. When one > >>>> of them is changed, the other one changes, too. I thought that the two > >>>> calls of (get-x-selection) might return the same object, which would > >>>> result in 'url' being replaced by 'sel'. So, I tried to copy the > >>>> string using copy-seq before assigning it to 'sel', but it didn't > >>>> help. Now I'm completely lost :) > >>>> > >>>> Finally, I came up with the version that works correctly when it is > >>>> run two times :). After the first execution, it pastes two selections > >>>> and no URL. If you re-select the area in Firefox and run the same > >>>> command, the expected output will appear. What is wrong here? > >>>> > >>>> (defcommand emacs-remember () () > >>>> "Send selection into emacs org-mode" > >>>> (let ((current-window-name (if (current-window) (window-title > >>>> (current-window)) "No current window")) > >>>> (current-window-class (if (current-window) (window-class > >>>> (current-window)) "No window class")) > >>>> (copy-from-firefox (equal (window-class (current-window)) > >>>> "Firefox")) > >>>> (sel (get-x-selection)) > >>>> (url "")) > >>>> (setf sel (get-x-selection)) > >>>> (when copy-from-firefox > >>>> (send-meta-key (current-screen) (kbd "F6")) > >>>> (send-meta-key (current-screen) (kbd "C-c")) > >>>> (setf url (get-x-selection)) > >>>> (send-meta-key (current-screen) (kbd "F6"))) > >>>> (run-or-raise "emacs" '(:class "Emacs")) > >>>> (send-meta-key (current-screen) (kbd "M-x")) > >>>> (window-send-string "org-capture") > >>>> (send-meta-key (current-screen) (kbd "RET")) > >>>> (window-send-string "f") > >>>> (window-send-string (format nil "~a~%~a~%~%" current-window-name > >>>> url)) > >>>> (window-send-string sel))) > >>>> > >>>> Thanks. > >>>> > >>>> -- > >>>> With best regards, > >>>> Dimitri Minaev > >>>> > >>>> _______________________________________________ > >>>> Stumpwm-devel mailing list > >>>> Stumpwm-devel@nongnu.org > >>>> https://lists.nongnu.org/mailman/listinfo/stumpwm-devel > >>> > >>> _______________________________________________ > >>> Stumpwm-devel mailing list > >>> Stumpwm-devel@nongnu.org > >>> https://lists.nongnu.org/mailman/listinfo/stumpwm-devel > > > > ------------------------------ > > Message: 3 > Date: Tue, 17 May 2016 09:45:10 +0400 > From: Dimitri Minaev <min...@gmail.com> > To: David Bjergaard <dbjerga...@gmail.com> > Cc: Dany Haddad <danyhadda...@gmail.com>, "stumpwm-devel@nongnu.org" > <stumpwm-devel@nongnu.org> > Subject: Re: [STUMP] Stump, Emacs and X selection. > Message-ID: > <CANTUpDAdgPSwTsjR7i= > lovbcuvjhtasxxgnm4tuf_3jqrz8...@mail.gmail.com> > Content-Type: text/plain; charset=UTF-8 > > David, > > When I run the command for the first time I get the org-mode capture > buffer that goes, for example, like this: > > > ---------------------------------------------------------------------------------- > * GitHub - stumpwm/stumpwm: The Stump Window Manager - Mozilla Firefox > Stumpwm is a window manager written entirely in Common Lisp. It > attempts to be highly customizable while relying entirely on the > keyboard for input. You will not find buttons, icons, title bars, tool > bars, or any of the other conventional GUI widgets. > > Stumpwm is a window manager written entirely in Common Lisp. It > attempts to be highly customizable while relying entirely on the > keyboard for input. You will not find buttons, icons, title bars, tool > bars, or any of the other conventional GUI widgets. > > ---------------------------------------------------------------------------------- > > Than I kill that buffer, get back to Firefox, reselect the paragraph > (because the primary selection contains the killed buffer now) and > repeat the command, getting the correct output: > > > ---------------------------------------------------------------------------------- > * GitHub - stumpwm/stumpwm: The Stump Window Manager - Mozilla Firefox > https://github.com/stumpwm/stumpwm > > Stumpwm is a window manager written entirely in Common Lisp. It > attempts to be highly customizable while relying entirely on the > keyboard for input. You will not find buttons, icons, title bars, tool > bars, or any of the other conventional GUI widgets. > > ---------------------------------------------------------------------------------- > > Doesn't it work like that for you? > > > On 16 May 2016 at 21:59, David Bjergaard <dbjerga...@gmail.com> wrote: > > Hi Dimitri, > > > > I'm not sure why you have to run it twice. I tried the snippet, and I > didn't > > see the text pop up until the second time I wrote it. As for dropping > non-latin > > characters: this is a known issue with StumpWM, and one that I'm slowly > trying > > to address. > > > > If you can get the bugs worked out (or not) you should put this on the > wiki > > since its a great example of using stumpwm to automate window actions > that may > > be tedious. > > > > David > > > > Dimitri Minaev <min...@gmail.com> writes: > > > >> Ah, that `setf'... :) It was just a leftover of one of my panicky > >> experiments when I tried to get rid of all possible delayed > >> evaluations. > >> > >> On 13 May 2016 at 21:12, Dany Haddad <danyhadda...@gmail.com> wrote: > >>> Dimitri, > >>> > >>> Cool snippet! > >>> > >>> I have not tried to run your code, but just looking over it brielfy: > >>> - Why are you setting `sel` in the `let` expression and immediately > after > >>> using `setf`? > >>> - I believe copy-seq does a shallow copy, so the elements will still be > >>> aliased, causing `quantum entanglement` > >>> - I haven't looked into the `get-x-selection` routine, but it could be > >>> stateful. Try looking into the source and maybe doing a deep copy on > its > >>> return value. > >>> > >>> Hope that helps! > >>> > >>> Dany > >>> > >>> On Fri, May 13, 2016 at 5:23 AM Patricio Martinez <maxx...@gmail.com> > wrote: > >>>> > >>>> Amazing, I'll probe it soon and I'll see how work. > >>>> > >>>> Thank you very much > >>>> > >>>> Sent from Nylas N1, the extensible, open source mail client. > >>>> On may. 13 2016, at 1:27 pm, Dimitri Minaev <min...@gmail.com> wrote: > >>>>> > >>>>> Hello, > >>>>> > >>>>> I'm trying to write a Stumpwm command that would create a note in > >>>>> Org-mode and paste the current selection and some other info taken > >>>>> from Firefox -- the URL and the tab title. While trying to implement > >>>>> the command I met a couple of problems. > >>>>> > >>>>> First, it doesn't work with non-Latin characters. I'm not sure > whether > >>>>> this is related to Stumpwm or Emacs. Stump's get-x-selection yields > >>>>> correct result, but window-send-string seemingly drops all Cyrillic > >>>>> characters from that string. > >>>>> > >>>>> Then the other problem appeared. To avoid confusion between the > >>>>> primary selection and the URL, I save the selection content in a > >>>>> variable before putting the URL to another variable, but it seems > that > >>>>> these two variables are in the state of quantum entanglement. When > one > >>>>> of them is changed, the other one changes, too. I thought that the > two > >>>>> calls of (get-x-selection) might return the same object, which would > >>>>> result in 'url' being replaced by 'sel'. So, I tried to copy the > >>>>> string using copy-seq before assigning it to 'sel', but it didn't > >>>>> help. Now I'm completely lost :) > >>>>> > >>>>> Finally, I came up with the version that works correctly when it is > >>>>> run two times :). After the first execution, it pastes two selections > >>>>> and no URL. If you re-select the area in Firefox and run the same > >>>>> command, the expected output will appear. What is wrong here? > >>>>> > >>>>> (defcommand emacs-remember () () > >>>>> "Send selection into emacs org-mode" > >>>>> (let ((current-window-name (if (current-window) (window-title > >>>>> (current-window)) "No current window")) > >>>>> (current-window-class (if (current-window) (window-class > >>>>> (current-window)) "No window class")) > >>>>> (copy-from-firefox (equal (window-class (current-window)) > >>>>> "Firefox")) > >>>>> (sel (get-x-selection)) > >>>>> (url "")) > >>>>> (setf sel (get-x-selection)) > >>>>> (when copy-from-firefox > >>>>> (send-meta-key (current-screen) (kbd "F6")) > >>>>> (send-meta-key (current-screen) (kbd "C-c")) > >>>>> (setf url (get-x-selection)) > >>>>> (send-meta-key (current-screen) (kbd "F6"))) > >>>>> (run-or-raise "emacs" '(:class "Emacs")) > >>>>> (send-meta-key (current-screen) (kbd "M-x")) > >>>>> (window-send-string "org-capture") > >>>>> (send-meta-key (current-screen) (kbd "RET")) > >>>>> (window-send-string "f") > >>>>> (window-send-string (format nil "~a~%~a~%~%" current-window-name > >>>>> url)) > >>>>> (window-send-string sel))) > >>>>> > >>>>> Thanks. > >>>>> > >>>>> -- > >>>>> With best regards, > >>>>> Dimitri Minaev > >>>>> > >>>>> _______________________________________________ > >>>>> Stumpwm-devel mailing list > >>>>> Stumpwm-devel@nongnu.org > >>>>> https://lists.nongnu.org/mailman/listinfo/stumpwm-devel > >>>> > >>>> _______________________________________________ > >>>> Stumpwm-devel mailing list > >>>> Stumpwm-devel@nongnu.org > >>>> https://lists.nongnu.org/mailman/listinfo/stumpwm-devel > > > > -- > With best regards, > Dimitri Minaev > > > > ------------------------------ > > Message: 4 > Date: Tue, 17 May 2016 11:10:31 +0400 > From: Dimitri Minaev <min...@gmail.com> > To: Milan Zamazal <p...@zamazal.org> > Cc: stumpwm-devel@nongnu.org > Subject: Re: [STUMP] Stump, Emacs and X selection. > Message-ID: > < > cantupda8a+y-afbp-h6oz3jop_or9fv4n3jticytvmdxlne...@mail.gmail.com> > Content-Type: text/plain; charset=UTF-8 > > Milan, > > Thank you very much for the idea. It doesn't seem to be general > enough, but it might work with Firefox. I planned to extend that > command to support other applications. So, in Thunderbird we can get a > link to the current message with Thunderlink extension. In Okular the > current document and the page number may be obtained via dbus -- an > awkward but sometimes useful contraption. That Stumpwm command works > with any program supporting X selections -- xterm, mutt, vim, Skype, > etc. They may have different ways to get the metadata, if any, but the > selected piece of text will be there, available for any other program. > I'm not yet sure if the same can be done using org-protocol. > Thunderbird does support it, but Okular, from what I can tell, does > not. > > > On 13 May 2016 at 22:11, Milan Zamazal <p...@zamazal.org> wrote: > >>>>>> "DM" == Dimitri Minaev <min...@gmail.com> writes: > > > > DM> that would create a note in Org-mode and paste the current > > DM> selection and some other info taken from Firefox -- the URL and > > DM> the tab title. > > > > Off-topic, but maybe still useful for someone here: This can be done > > without StumpWM, just with Emacs and Firefox: > > > > https://github.com/alphapapa/org-protocol-capture-html > > > > > > > > _______________________________________________ > > Stumpwm-devel mailing list > > Stumpwm-devel@nongnu.org > > https://lists.nongnu.org/mailman/listinfo/stumpwm-devel > > > > -- > With best regards, > Dimitri Minaev > > > > ------------------------------ > > Message: 5 > Date: Tue, 17 May 2016 09:25:17 -0400 > From: David Bjergaard <dbjerga...@gmail.com> > To: Dimitri Minaev <min...@gmail.com> > Cc: Milan Zamazal <p...@zamazal.org>, stumpwm-devel@nongnu.org > Subject: Re: [STUMP] Stump, Emacs and X selection. > Message-ID: <87inycddfm....@gmail.com> > Content-Type: text/plain > > Hi Dimitri, > > I'm excited to hear that you are going to extend this beyond firefox. When > you're ready, feel free to open a PR with stumpwm-contrib and we can add it > there. > > David > > > Dimitri Minaev <min...@gmail.com> writes: > > > Milan, > > > > Thank you very much for the idea. It doesn't seem to be general > > enough, but it might work with Firefox. I planned to extend that > > command to support other applications. So, in Thunderbird we can get a > > link to the current message with Thunderlink extension. In Okular the > > current document and the page number may be obtained via dbus -- an > > awkward but sometimes useful contraption. That Stumpwm command works > > with any program supporting X selections -- xterm, mutt, vim, Skype, > > etc. They may have different ways to get the metadata, if any, but the > > selected piece of text will be there, available for any other program. > > I'm not yet sure if the same can be done using org-protocol. > > Thunderbird does support it, but Okular, from what I can tell, does > > not. > > > > > > On 13 May 2016 at 22:11, Milan Zamazal <p...@zamazal.org> wrote: > >>>>>>> "DM" == Dimitri Minaev <min...@gmail.com> writes: > >> > >> DM> that would create a note in Org-mode and paste the current > >> DM> selection and some other info taken from Firefox -- the URL and > >> DM> the tab title. > >> > >> Off-topic, but maybe still useful for someone here: This can be done > >> without StumpWM, just with Emacs and Firefox: > >> > >> https://github.com/alphapapa/org-protocol-capture-html > >> > >> > >> > >> _______________________________________________ > >> Stumpwm-devel mailing list > >> Stumpwm-devel@nongnu.org > >> https://lists.nongnu.org/mailman/listinfo/stumpwm-devel > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > Stumpwm-devel mailing list > Stumpwm-devel@nongnu.org > https://lists.nongnu.org/mailman/listinfo/stumpwm-devel > > > ------------------------------ > > End of Stumpwm-devel Digest, Vol 130, Issue 2 > ********************************************* >
_______________________________________________ Stumpwm-devel mailing list Stumpwm-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/stumpwm-devel