X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=emacs.d%2Fconfig.org;h=064a1b39088a48f34a7ad40787b703064e8d3387;hb=dfc61390fb1055e4f5d0df2c762de4cd8885248d;hp=710c43ee04c7c2ae799b524ea012985757f35548;hpb=142fc5397c281ab63da5df72b32f01b88d30d80e;p=dotfiles.git diff --git a/emacs.d/config.org b/emacs.d/config.org index 710c43e..064a1b3 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 (or (read-string "Save to (~/Downloads): ") "~/Downloads"))) + (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 @@ -1510,7 +1533,8 @@ brew install the-silver-searcher (define-key dired-mode-map (kbd "TAB") 'diredp-next-subdir) (define-key dired-mode-map (kbd "K") 'diredp-prev-subdir) (define-key dired-mode-map (kbd "O") 'dired-display-file) - (define-key dired-mode-map (kbd "I") 'other-window)) + (define-key dired-mode-map (kbd "I") 'other-window) + (define-key dired-mode-map (kbd "o") 'other-window)) (use-package dired :config @@ -1681,7 +1705,8 @@ here on Mac, just use "open" commands to pen =.pdf=, =.html= and image files ;; should map both (kbd "TAB") and [tab],https://github.com/company-mode/company-mode/issues/75 (define-key company-active-map (kbd "TAB") #'company-complete-selection) (define-key company-active-map [tab] #'company-complete-selection) - (global-company-mode)) + (global-company-mode) + (setq company-global-modes '(not org-mode))) (use-package company-statistics :ensure t @@ -2054,6 +2079,42 @@ irony-company :ensure t) #+END_SRC +** Scheme +Install =guile=, =guile= is an implementation of =Scheme= programming language. +#+BEGIN_SRC sh + brew install guile +#+END_SRC + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (setq geiser-scheme-implementation 'guile) +#+END_SRC + +#+BEGIN_SRC scheme + (define a "3") + a +#+END_SRC + +#+RESULTS: +: 3 + +** Racket +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (use-package racket-mode + :ensure t + :config + (define-key racket-mode-map (kbd "s-r") 'racket-run) + (add-to-list 'racket-mode-hook (lambda () (lispy-mode 1)))) + + ;; set racket path + (setenv "PATH" (concat (getenv "PATH") + ":" "/Applications/Racket v6.6/bin")) + (setenv "MANPATH" (concat (getenv "MANPATH") + ":" "/Applications/Racket v6.6/man")) + (setq exec-path (append exec-path '("/Applications/Racket v6.6/bin"))) + + (add-to-list 'auto-mode-alist '("\\.rkt\\'" . racket-mode)) +#+END_SRC + * Compile Set the environments vairables in compilation mode #+BEGIN_SRC emacs-lisp :tangle yes :results silent @@ -2097,7 +2158,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;" @@ -2116,7 +2177,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" @@ -2819,6 +2880,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