help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Search StackOverflow and paste code snippets without leaving the edi


From: Andrey Tykhonov
Subject: Re: Search StackOverflow and paste code snippets without leaving the edited file
Date: Fri, 3 Jan 2014 16:36:52 +0200

Hi Tom, hi York Zhao, hi all!

I just recently finished new version of howdoi.el :
https://github.com/atykhonov/emacs-howdoi

It was totally reimplemented. And now it doesn't require python's `howdoi`
command line tool. It works without it.

Few words about its current usage.

There is line "format date bash" in a *scratch* buffer. You could execute
M-x howdoi-query-line-at-point-replace-by-code-snippet RET and mentioned
line will be replaced by "DATE=`date +%Y-%m-%d`".

Other example. There could be "elisp split string" in the *scratch* buffer.
After execution of `howdoi-query-line-at-point-replace-by-code-snippet`
mentioned string will be replaced by (split-string "1.2.3" "\\."). While
reading this (or any other answer) you may be wanted to get additional
info, for example: why '.' is escaped and why '\'? You could execute then
`howdoi-show-current-question` and a pop up buffer will be shown with full
answer and you'll get a chance to get additional explanations without needs
to make additional queries.

You could also do M-x howdoi-query RET <your-query> RET or M-x
howdoi-query-line-at-point and you'll get an answer in a pop up buffer.

For example: M-x howdoi-query RET howdoi RET

In a pop up buffer you could use key bindings such as C-c C-n and C-c C-p
to get next/previous questions which are similar to the original one
(<your-query>).

In a pop up buffer only an answers are shown. To be able to see an question
change `howdoi-display-question` variable value to t.

Few words about implementation.

I was looking for a elisp library which will help to parse html. And I
found libxml-parse-html-region but I was not able to use it as my emacs
required to be re-compiled with libxml. Well, I recompiled it and now that
function is available for me but I decided to avoid usage of this function
as this dependency may be broken for someone else. So for html-parsing I
used regexps. May be that was wrong decision to use regexps... I would like
to hear your opinions about it.

Then I decided to avoid usage of emacs-request library and built-in url.el
emacs library was used instead. So seems there are no any external
dependency for howdoi.el. It should just work.

Check out howdoi.el from
https://github.com/atykhonov/emacs-howdoi/<https://github.com/atykhonov/emacs-howdoi/blob/master/howdoi.el>
git-repository,
use and enjoy!

Look forward for your comments, suggestions, opinions, feature requests!...



Best regards,
Andrey


2013/12/29 York Zhao <gtdplatform@gmail.com>

> Hi Andrey,
>
> Thank you very much for your reply. I'm sorry that I was wrong on guessing
> you
> were using Windows as I saw from your example on GitHub you used `\' as
> path
> name separator.
>
> Glad to know your plan for rewriting "howdoi" in Emacs lisp, that's really
> interesting and I'm looking forward to try it out once it is ready.
>
> I may try you suggestion to see how the python "howdoi" goes on my system.
>
> Thanks,
>
> York
>


reply via email to

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