emacs - replace custom-set-xx with set-; use counsel-M-x instead M-x
[dotfiles.git] / emacs.d / config.org
index 77ab382..a11d9c4 100644 (file)
@@ -406,7 +406,6 @@ Install powerline mode [[https://github.com/milkypostman/powerline][powerline]]
 #+END_SRC
 
 Revised powerline-center-theme
-
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (defun sd/powerline-simpler-vc (s)
     (if s
@@ -421,11 +420,23 @@ Revised powerline-center-theme
     "My Powerline face 1 based on powerline-active1."
     :group 'powerline)
 
+  (defface sd/buffer-view-active1 '((t (:background "green" :foreground "black" :inherit mode-line)))
+    "My Powerline face 1 based on powerline-active1."
+    :group 'powerline)
+
   (defface sd/mode-line-buffer-id
     '((t (:background "yellow" :foreground "black" :inherit mode-line-buffer-id)))
     "My powerline mode-line face, based on mode-line-buffer-id"
     :group 'powerline)
 
+  ;; Don't show buffer modified for scratch and eshell mode
+  (defun sd/buffer-show-modified ()
+    "Dot not show modified indicator for buffers"
+    (interactive)
+    (unless (or (string-match "*scratch*" (buffer-name))
+                (equal major-mode 'eshell-mode))
+      t))
+
   (defun sd/powerline-center-theme_revised ()
     "Setup a mode-line with major and minor modes centered."
     (interactive)
@@ -436,10 +447,10 @@ Revised powerline-center-theme
                             (mode-line-buffer-id (if active 'sd/mode-line-buffer-id 'mode-line-buffer-id-inactive))
                             (mode-line (if active 'mode-line 'mode-line-inactive))
                             (my-face1 (if active 'sd/powerline-active1 'powerline-inactive1))
-                            (my-face-buffer-modified (if (buffer-modified-p)
+                            (my-face-buffer-modified (if (and (sd/buffer-show-modified) (buffer-modified-p)) 
                                                          'sd/buffer-modified-active1
-                                                       (if active  'sd/powerline-active1
-                                                         'powerline-inactive1)))
+                                                       (if buffer-read-only 'sd/buffer-view-active1
+                                                         my-face1)))
                             (face1 (if active 'powerline-active1 'powerline-inactive1))
                             (face2 (if active 'powerline-active2 'powerline-inactive2))
                             (separator-left (intern (format "powerline-%s-%s"
@@ -448,7 +459,7 @@ Revised powerline-center-theme
                             (separator-right (intern (format "powerline-%s-%s"
                                                              (powerline-current-separator)
                                                              (cdr powerline-default-separator-dir))))
-                            (lhs (list (powerline-raw "%*" my-face-buffer-modified 'l)
+                            (lhs (list (powerline-raw "%* " my-face-buffer-modified 'l)
                                        ;; (powerline-buffer-size mode-line 'l)
                                        (powerline-buffer-id mode-line-buffer-id 'l)
                                        (powerline-raw " " my-face1)
@@ -461,9 +472,11 @@ Revised powerline-center-theme
                                        (powerline-raw ":" face1)     
                                        (powerline-raw "%3c" face1 'r)
                                        (funcall separator-right face1 my-face1)
-                                       (powerline-raw " " my-face1)              
-                                       (powerline-raw "%6p" my-face1 'r)
-                                       (powerline-hud my-face1 face1 )))
+                                       ;; (powerline-raw " " my-face1)
+                                       (powerline-raw (format-time-string " %I:%M %p ") my-face1 'r)
+                                       ;; (powerline-raw "%6p" my-face1 'r)
+                                       ;; (powerline-hud my-face1 face1 )
+                                       ))
                             (center (list (powerline-raw " " face1)
                                           (funcall separator-left face1 face2)
                                           (when (and (boundp 'erc-track-minor-mode) erc-track-minor-mode)
@@ -484,21 +497,19 @@ Revised powerline-center-theme
 #+END_SRC
 
 Fix the issue in mode line when showing triangle 
-
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (setq ns-use-srgb-colorspace nil)
 #+END_SRC
 
 set height in mode line
-
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
-
-  (custom-set-variables
-   '(powerline-height 14)
-   '(powerline-text-scale-factor 0.8))
-  ;; 100/140
+  (set-variable 'powerline-height 14)
+  (set-variable 'powerline-text-scale-factor (/ (float 100) 140))
+  ;; (custom-set-variables
+  ;;  '(powerline-height 14)
+  ;;  '(powerline-text-scale-factor (/ (float 100) 140)))
+  ;; 100/140;0.8
   (set-face-attribute 'mode-line nil :height 100)
-
 #+END_SRC
 
 * IDO & SMEX
@@ -617,10 +628,10 @@ Stolen from [[https://github.com/redguardtoo/emacs.d/blob/master/lisp/init-spell
   ;;   ;; Turn off RUN-TOGETHER option when spell check text-mode
   ;;   (setq-local ispell-extra-args (flyspell-detect-ispell-args)))
   ;; (add-hook 'text-mode-hook 'text-mode-hook-setup)
-  (add-hook 'text-mode-hook 'flyspell-mode)
+  ;; (add-hook 'text-mode-hook 'flyspell-mode)
 
   ;; enable flyspell check on comments and strings in progmamming modes
-  (add-hook 'prog-mode-hook 'flyspell-prog-mode)
+  ;; (add-hook 'prog-mode-hook 'flyspell-prog-mode)
 
   ;; I don't use the default mappings
   (with-eval-after-load 'flyspell
@@ -887,10 +898,10 @@ Occur search key bindings
   ;; (global-set-key "\C-s" 'swiper)
   ;; (global-set-key (kbd "C-c C-r") 'ivy-resume)
   ;; (global-set-key (kbd "<f6>") 'ivy-resume)
-  ;; ;; (global-set-key (kbd "M-x") 'counsel-M-x)
+  (global-set-key (kbd "M-x") 'counsel-M-x)
   ;; ;; (global-set-key (kbd "C-x C-f") 'counsel-find-file)
-  ;; (global-set-key (kbd "<f1> f") 'counsel-describe-function)
-  ;; (global-set-key (kbd "<f1> v") 'counsel-describe-variable)
+  (global-set-key (kbd "C-h f") 'counsel-describe-function)
+  (global-set-key (kbd "C-h v") 'counsel-describe-variable)
   ;; (global-set-key (kbd "<f1> l") 'counsel-load-library)
   ;; (global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
   ;; (global-set-key (kbd "<f2> u") 'counsel-unicode-char)
@@ -901,6 +912,10 @@ Occur search key bindings
   ;; (global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
   ;; ;; (define-key read-expression-map (kbd "C-r") 'counsel-expression-history)
 
+  (set-face-attribute
+   'ivy-current-match nil
+   :background "Orange"
+   :foreground "black")
 #+END_SRC
 
 *** =M-s= prefix
@@ -988,7 +1003,8 @@ Always indents header, and hide header leading starts so that no need type =#+ST
      (sh . t)
      (sqlite . t)
      (js . t)
-     (gnuplot . t)))
+     (gnuplot . t)
+     (ditaa . t)))
 
   ;; use current window for org source buffer editting
   (setq org-src-window-setup 'current-window )
@@ -1802,11 +1818,6 @@ When see function by =C-h f=, and visit the source code, I would like the buffer
 
 ** TODO Man mode
 Color for Man-mode
-#+BEGIN_SRC emacs-lisp :tangle yes :results silent
-  ;; (add-hook 'Man-mode-hook (lambda ()
-  ;;                         (interactive)
-  ;;                         (setenv "GROFF_NO_SRG")))
-#+END_SRC
 
 ** TODO swiper to occur
 
@@ -1945,13 +1956,18 @@ Refer [[https://www.emacswiki.org/emacs/AutoInsertMode][AutoInsertMode]] Wiki
          )))
 #+END_SRC
 
-*** Keywords
+*** Perl Keywords
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (font-lock-add-keywords 'cperl-mode
-                          '(("\\(say\\)" . font-lock-function-name-face)))
+                          '(("\\(say\\)" . cperl-nonoverridable-face)
+                            ("\\([0-9.]\\)*" . font-lock-constant-face)
+                            ("\".*\\(\\\n\\).*\"" . font-lock-constant-face)
+                            ("\n" . font-lock-constant-face)
+                            ("\\(^#!.*\\)$" .  cperl-nonoverridable-face)))
+
+    ;; (font-lock-add-keywords 'Man-mode
+    ;;                         '(("\\(NAME\\)" . font-lock-function-name-face)))
 
-  (font-lock-add-keywords 'Man-mode
-                          '(("\\(NAME\\)" . font-lock-function-name-face)))
 #+END_SRC
 
 *** Run Perl
@@ -2321,6 +2337,16 @@ Use =gnuplot= on =Org-mode= file, see [[http://orgmode.org/worg/org-contrib/babe
 - passion
 - vision
 - mission
+* Ediff
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+  (with-eval-after-load 'ediff
+    (setq ediff-split-window-function 'split-window-horizontally)
+    (setq ediff-window-setup-function 'ediff-setup-windows-plain)
+    (add-hook 'ediff-startup-hook 'ediff-toggle-wide-display)
+    (add-hook 'ediff-cleanup-hook 'ediff-toggle-wide-display)
+    (add-hook 'ediff-suspend-hook 'ediff-toggle-wide-display))
+#+END_SRC
+
 * TODO Convert ASCII to key
 ** map =function-key-map= [[http://academic.evergreen.edu/projects/biophysics/technotes/program/ascii_ctrl.htm][ascii_ctrl]]
 new file =C-x C-f C-f=
@@ -2329,9 +2355,27 @@ new file =C-x C-f C-f=
 
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (font-lock-add-keywords 'perl-mode '(("\\(|\\w+?\\(,\\w+?\\)?|\\)" 1 'py-builtins-face)))
-
-  (font-lock-add-keywords
-   'cperl-mode
-  '(("\\(say\\)" . font-lock-constant-face)))
 #+END_SRC
 
+* TODO set fly-spell binding
+
+* TODO imenu bindings
+
+* DONE modified indicator
+:LOGBOOK:
+- State "DONE"       from "TODO"       [2016-07-18 Mon 23:35]
+:END:
+* DONE highlight selected ido candicate
+:LOGBOOK:
+- State "DONE"       from "TODO"       [2016-07-19 Tue 01:49]
+:END:
+* DONE show time in right of mode-line
+:LOGBOOK:
+- State "DONE"       from "TODO"       [2016-07-19 Tue 01:11]
+:END:
+* DONE ediff mode
+:LOGBOOK:
+- State "DONE"       from "TODO"       [2016-07-19 Tue 01:11]
+:END:
+* TODO jump last change point
+* TODO emms mode-line