Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement of instructions and editing web with emacs #4

Open
MorphicResonance opened this issue Feb 5, 2022 · 6 comments
Open

Improvement of instructions and editing web with emacs #4

MorphicResonance opened this issue Feb 5, 2022 · 6 comments

Comments

@MorphicResonance
Copy link

MorphicResonance commented Feb 5, 2022

Thanks for raising the problem of directly passing text to and from the browser to emacs. So far, I have seen very few solutions for collecting information from a browser without a clipboard.

For example, Grasp firefox extension for org-capture gathers information into an org file on keystrokes. But the python configuration introduces unnecessary complexity into the organization and leads away from the required implementation "without additional layers". Emacs Everywhere still uses clipboard and some xdotool dependencies.

In emacs, this issue is sort of resolved automatically if you use the Emacs inbuild browser yourself. Unfortunately, it does not handle many sites.

Unfortunately, the instructions leave a lot to be desired. Despite the abundance of posts, there is no direct instruction on the installation process, no adjustments are made to the process yet.

How did I manage to install emacs-with-nyxt after looking for information in many places.

  1. installed the sly package from melpa.
    Added use via use-package to my emacs configuration file
    (use-package sly :config (setq sly-lisp-implementations '((sbcl ("/usr/bin/sbcl")))) )

  2. Run linux package manager which installed sbcl to /usr/bin/sbcl

  3. Installed quicklisp as found it nned in the file emacs-with-nyxt.el. Detailed instructions on installation, fortunately, on the official site

  4. added an auto-config.lisp file to ~/.config/nyxt and an emacs-with-nyxt.el file to the folder where my emacs packages are located (/contrib/ in my case).

  5. Added a package call to my emacs configuration file
    (use-package emacs-with-nyxt :ensure nil :load-path "~/.emacs.d/contrib/emacs-with-nyxt")

  6. not finding a connection & following the advice of users, added a symlink from the /slynk subfolder to the subfolder where the sly package is located which was installed from melpa.
    sudo ln -s ~/.local/share/nyxt/extensions/slynk/ ~/.emacs.d/elpa/sly-20220131.1646/slynk/

After that, the connection is created. The browser is controlled from emacs. You can send a command to open this or that url from emacs.

But the most hot part is how to send text directly from emacs into the browser.
From the one post where you are on the form in browser and typed ctrl-x ' and it will open emacs, then type ctrl-x # and emacs will send some text to the form I don't see this happen.
For example, opened google search form , typed ctrl-x ' and just ' was put into search form. After pressing ctrl-x # I see message something like this 'no server editing buffer..' .

What to do to actually send text from emacs to nyxt? Can text from any file wtih emacs be sent into nyxt?

@ag91
Copy link
Owner

ag91 commented Feb 8, 2022

thanks for sharing how you made it work: I will review the README with your instructions :)

About your question, I think the default keybindings of Nyxt may be different: you are looking for the command edit-with-external-editor. Point in the Google search bar and then invoke that command and it will open Emacs.
Let me know if that helps!

I set Emacs as my external editor in Nyxt like this

(define-configuration browser
  ((external-editor-program '("/usr/bin/emacsclient"))))

@MorphicResonance
Copy link
Author

MorphicResonance commented Feb 8, 2022

Found it yesterday that there is such 'edit-with-external-editor' command in Nyxt browser and also that it's no need to install sly package for it.
So my instruction is relevant to make all contents of emacs-with-nyxt.el workable. If you add the code from the posts also to nyxt config so to scrape text from web pages from nyxt to emacs and put text from emacs to web form in nyxt user don't need install sly package. Got org-capture working according to posts just putting code snippets from your posts.

It would be cool to have small function for Nyxt to copy url of the webpage as org-mode link. Don't need webpage title url in formatted as org capture template always . But orgmode formatted url pagetitle is handy in many cases.

The process of submitting text to a web form is not smooth. Emacs opens a temporary file and only when it is saved the text is sent to the browser. I would like to work from a permanent file, send only the selected text from the file, without the requirement to save, and the like.
Maybe there are some improvements for this (this text was sent from emacs from the file tmpVZTRIZD7.tmp).

@ag91
Copy link
Owner

ag91 commented Feb 8, 2022

Well you can edit Nyxt to do what you want. You need Sly or Slime to send text to Nyxt if you start from Emacs. When you use edit-with-external-editor you are running a Nyxt command.

If I understand things right, you would like to be in Nyxt, browse around, click on a text area, then switch to Emacs and send parts of a file to that text area, correct?
If so you need to inspect how edit-with-external-editor works and reuse the part that fills the text area but this time with strings from Emacs. It sounds doable and an interesting idea!

@MorphicResonance
Copy link
Author

MorphicResonance commented Feb 12, 2022

I would like to do something in didderent domension. Being in edit-with-external-editor . Click on text area in nyxt and be able insert just selected text from static .org file (not just temp file with random name) or just text from selected org node.

Case study example org file : you've posted several job postings on several freelance site . You have some specific info for each site, some questions, some notes. But they are all related to 1 goal and should be in 1 static file . More it all can be just a small part (deep subtree) of big file.

@ag91
Copy link
Owner

ag91 commented Feb 14, 2022 via email

@MorphicResonance
Copy link
Author

Try to implement the simpliest possible way because right now input from emacs to nyxt with undefined temp file looks like incomplete sdemo action.
org-ql will work well for searching subtrees but it could be possible selected text in the opened file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants