emacs - major-mode display on mode-line
[dotfiles.git] / emacs.d / config.org
index ce1075c..e3f98e5 100644 (file)
@@ -340,9 +340,7 @@ Enable rainbow mode in emacs lisp mode
 * Mode-line
 
 ** clean mode line
-
-clean mode line, Refer to [[https://www.masteringemacs.org/article/hiding-replacing-modeline-strings][Marstering Emacs]]
-
+clean mode line, Refer to [[https://www.masteringemacs.org/article/hiding-replacing-modeline-strings][Marstering Emacs]], some greek character see [[http://xahlee.info/math/math_unicode_greek.html][math_unicode_greek]]
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (defvar mode-line-cleaner-alist
     `((auto-complete-mode . " α")
@@ -371,7 +369,10 @@ clean mode line, Refer to [[https://www.masteringemacs.org/article/hiding-replac
       (hi-lock-mode . "")
       (python-mode . "Py")
       (emacs-lisp-mode . "EL")
-      (eshell-mode . "ε")
+      (eshell-mode . "𝞔")
+      (dired-mode . "𝞓")
+      (ibuffer-mode . "𝞑")
+      (org-mode . "𝞞")
       (nxhtml-mode . "nx"))
     "Alist for `clean-mode-line'.
 
@@ -397,9 +398,7 @@ clean mode line, Refer to [[https://www.masteringemacs.org/article/hiding-replac
 #+END_SRC
 
 ** Powerline mode
-
 Install powerline mode [[https://github.com/milkypostman/powerline][powerline]]
-
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (use-package powerline
     :ensure t
@@ -525,7 +524,7 @@ set height in mode line
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (use-package ido
     :ensure t
-    :init (setq ido-enable-flex-matching t
+    :init (setq ido-enable-flex-matching nil
                 ido-ignore-extensions t
                 ido-use-virtual-buffers t
                 ido-everywhere t)
@@ -542,9 +541,9 @@ set height in mode line
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (use-package flx-ido
     :ensure t
-    :init (setq ido-enable-flex-matching t
+    :init (setq ido-enable-flex-matching nil
                 ido-use-faces nil)
-    :config (flx-ido-mode 1))
+    :config (flx-ido-mode nil))
 #+END_SRC
 
 ** IDO-vertically
@@ -1101,6 +1100,8 @@ Toggle an eshell in split window below, refer [[http://www.howardism.org/Technic
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (use-package exec-path-from-shell
     :ensure t
+    :init
+    (setq exec-path-from-shell-check-startup-files nil)
     :config
     (exec-path-from-shell-initialize))
 #+END_SRC
@@ -1547,6 +1548,34 @@ here on Mac, just use "open" commands to pen =.pdf=,  =.html= and image files
           ("\\.html?\\'" "open")
           ("\\.dmg\\'" "open")
           ("\\.cue?\\'" "audacious")))
+
+
+  (defun sd/dired-start-process (cmd &optional file-list)
+    (interactive
+     (let ((files (dired-get-marked-files
+                   t current-prefix-arg)))
+       (list
+        (unless (eq system-type 'windows-nt)
+          (dired-read-shell-command "& on %s: "
+                                    current-prefix-arg files))
+        files)))
+    
+    (if (eq system-type 'windows-nt)
+        (dolist (file file-list)
+          (w32-shell-execute "open" (expand-file-name file)))
+      (let (list-switch)
+        (start-process
+         cmd nil shell-file-name
+         shell-command-switch
+         (format
+          "nohup 1>/dev/null 2>/dev/null %s \"%s\""
+          cmd
+          ;; (if (and (> (length file-list) 1)
+          ;;          (setq list-switch
+          ;;                (cadr (assoc cmd ora-dired-filelist-cmd))))
+          ;;     (format "%s %s" cmd list-switch)
+          ;;   cmd)
+          (mapconcat #'expand-file-name file-list "\" \""))))))
 #+END_SRC
 
 ** dired-hacks
@@ -1712,6 +1741,7 @@ to call =compilation=  interactively.
   (use-package flycheck
     :ensure t)
 #+END_SRC
+
 *** irony
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (use-package irony
@@ -1728,7 +1758,7 @@ Install clang, on mac, it has =libclang.dylib=, but no develop headers. Install
 #+END_SRC
 
 then install irony searver, and =LIBCLANG_LIBRARY= and =LIBCLANG_INCLUDE_DIR= accordingly
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+#+BEGIN_SRC emacs-lisp :tangle no :results silent
   (irony-install-server)
 #+END_SRC
 
@@ -1739,6 +1769,34 @@ then install irony searver, and =LIBCLANG_LIBRARY= and =LIBCLANG_INCLUDE_DIR= ac
         /Users/peli3/.emacs.d/elpa/irony-20160713.1245/server && cmake --build . --use-stderr --config Release --target install 
 #+END_SRC
 
+irony-mode-hook, copied from [[https://github.com/Sarcasm/irony-mode][irony-mode]] github
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+  ;; replace the `completion-at-point' and `complete-symbol' bindings in
+  ;; irony-mode's buffers by irony-mode's function
+  (defun my-irony-mode-hook ()
+    (define-key irony-mode-map [remap completion-at-point]
+      'irony-completion-at-point-async)
+    (define-key irony-mode-map [remap complete-symbol]
+      'irony-completion-at-point-async))
+  (add-hook 'irony-mode-hook 'my-irony-mode-hook)
+  (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
+#+END_SRC
+
+irony-company
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+  (use-package company-irony
+    :ensure t)
+
+  (eval-after-load 'company
+    '(add-to-list 'company-backends 'company-irony))
+
+  (use-package flycheck-irony
+    :ensure t)
+
+  (eval-after-load 'flycheck
+    '(add-hook 'flycheck-mode-hook #'flycheck-irony-setup))
+#+END_SRC
+
 *** yasnippet
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (use-package yasnippet