Add a command to download a file into a buffer
This commit is contained in:
parent
f7300b3a66
commit
ece9e88d5e
@ -325,6 +325,10 @@ but provide support for writing custom elisp.
|
|||||||
(imalison:use-package emit
|
(imalison:use-package emit
|
||||||
:demand t)
|
:demand t)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
*** request
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(use-package request)
|
||||||
|
#+END_SRC
|
||||||
** Macros
|
** Macros
|
||||||
*** Named Build
|
*** Named Build
|
||||||
imalison:named-build provides a way to invoke a macro in such a way
|
imalison:named-build provides a way to invoke a macro in such a way
|
||||||
@ -684,6 +688,22 @@ A macro for composing functions together to build an interactive command to copy
|
|||||||
(save-excursion
|
(save-excursion
|
||||||
(perform-replace "\\n" "\n" nil nil delimited nil nil beg end nil)))))
|
(perform-replace "\\n" "\n" nil nil delimited nil nil beg end nil)))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
** Download a File Into a Buffer
|
||||||
|
#+BEGIN_SRC emacs-lisp
|
||||||
|
(defun imalison:download-to-buffer (uri)
|
||||||
|
(interactive (list (read-string "Enter uri: ")))
|
||||||
|
(request uri
|
||||||
|
:parser 'buffer-string
|
||||||
|
:success (cl-function
|
||||||
|
(lambda (&key data &allow-other-keys)
|
||||||
|
(message "called")
|
||||||
|
(let ((created-buffer (get-buffer-create uri)))
|
||||||
|
(message "here")
|
||||||
|
(message "buf: %s" created-buffer)
|
||||||
|
(with-current-buffer created-buffer
|
||||||
|
(insert data))
|
||||||
|
(switch-to-buffer created-buffer))))))
|
||||||
|
#+END_SRC
|
||||||
** Other
|
** Other
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(defun imalison:join-paths (&rest paths)
|
(defun imalison:join-paths (&rest paths)
|
||||||
|
Loading…
Reference in New Issue
Block a user