X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=emacs.d%2Fconfig.org;h=c33ddb5168999dde652421166e3568bdd8d5dc76;hb=0b2dd81e437b0e7d55fa590964859b55a9bb0543;hp=b9c0209354016c6c7b34cd2ea56105bfe85f2eb0;hpb=6e6b4ae1dae6518a03eaa503382b110f2cc1ca00;p=dotfiles.git diff --git a/emacs.d/config.org b/emacs.d/config.org index b9c0209..c33ddb5 100644 --- a/emacs.d/config.org +++ b/emacs.d/config.org @@ -1471,6 +1471,29 @@ brew install the-silver-searcher (add-hook 'text-mode-hook 'table-recognize) #+END_SRC +** url-download +To download file in =elisp=, best is =url-copy-file=, here refer [[http://stackoverflow.com/questions/4448055/download-a-file-with-emacs-lisp][download-a-file-with-emacs-lisp]] using =url-retrieve-synchronously= wrapping +as a http download client tool +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (defun sd/download-file (&optional url download-dir download-name) + (interactive) + (let ((url (or url + (read-string "Enter download URL: "))) + (download-dir (read-directory-name "Save to (~/Downloads): " "~/Downloads" "~/Downloads" 'confirm' nil))) + (let ((download-buffer (url-retrieve-synchronously url))) + (save-excursion + (set-buffer download-buffer) + ;; we may have to trim the http response + (goto-char (point-min)) + (re-search-forward "^$" nil 'move) + (forward-char) + (delete-region (point-min) (point)) + (write-file (concat (or download-dir + "~/Downloads/") + (or download-name + (car (last (split-string url "/" t)))))))))) +#+END_SRC + * Dired ** Dired bindings =C-o= is defined as a global key for window operation, here unset it in dired mode @@ -1581,6 +1604,7 @@ Disalble =ido= when new a directory or file in =dired= mode ;; call the function which you want to disable ido (mk-disable-ido 'dired-create-directory) (mk-disable-ido 'sd/dired-new-file) + (mk-disable-ido 'dired-goto-file) #+END_SRC ** Dired open with @@ -2135,7 +2159,7 @@ Set the environments vairables in compilation mode (file-name-nondirectory (buffer-file-name))) ".hpp\"" \n \n "using namespace std;" \n \n - "int main ()" + "int main (int argc, char *argv[])" "\n{" \n > _ \n "return 0;" @@ -2154,7 +2178,7 @@ Set the environments vairables in compilation mode (file-name-sans-extension (file-name-nondirectory (buffer-file-name))) ".h\"" \n \n - "int main ()\n" + "int main (int argc, char *argv[])\n" "{" \n > _ \n "return 0;\n" @@ -2857,6 +2881,11 @@ Search, replace and hightlight will in later paragraph #+BEGIN_SRC emacs-lisp :tangle yes :results silent (global-set-key (kbd "M-i") #'counsel-imenu) ;; (global-set-key (kbd "M-i") #'imenu) + + ;; define M-[ as C-M-a + ;; http://ergoemacs.org/emacs/emacs_key-translation-map.html + (define-key key-translation-map (kbd "M-[") (kbd "C-M-a")) + (define-key key-translation-map (kbd "M-]") (kbd "C-M-e")) #+END_SRC *** Go-to line