merged
authorOleksandr Gavenko <gavenkoa@gmail.com>
Fri, 17 Sep 2010 16:05:23 +0300
changeset 478 2e18034ae7fd
parent 473 1334dc79ea80 (diff)
parent 477 e1adf1d08f5b (current diff)
child 479 6ca398b20643
merged
.emacs-my
--- a/.emacs-my	Sun Sep 12 21:42:35 2010 +0300
+++ b/.emacs-my	Fri Sep 17 16:05:23 2010 +0300
@@ -465,15 +465,16 @@
 (defun my-dired-up-dir ()
   "'Reuse' buffer if enter to dir or open new buffer if enter to file."
   (interactive)
-  (let* ( (dir (dired-current-directory)) (i (- (length dir) 2)) newdir )
+  ;; (dired-current-directory) always end with trailing '/' char.
+  (let* ( (dir (dired-current-directory)) (i (- (length dir) 2)) upperdir )
     (while (and
             (>= i 0)
             (not (equal (aref dir i) ?/)) )
       (setq i (- i 1))
       )
-    (setq newdir (substring dir 0 (max 0 i)))
-    (when (file-directory-p newdir)
-      (find-alternate-file newdir)
+    (setq upperdir (substring dir 0 (+ i 1)))
+    (when (file-directory-p upperdir)
+      (find-alternate-file upperdir)
       (dired-goto-file dir)
       )
     ))
@@ -495,6 +496,23 @@
   (put 'dired-find-alternate-file 'disabled nil)
   )
 
+(defun my-file-name-tmp-p (file)
+  (string-match "\\(^#.*#\\|~\\|\\.orig\\|\\.log\\)\\'" (file-name-nondirectory file)))
+
+(defun my-dired-flag-tmp-files ()
+  "Flag all temporary files for deletion."
+  (interactive)
+  (dired-mark-if
+   ;; (let ( (fn (dired-get-filename)) )
+   ;;   (if fn (backup-file-name-p fn)))
+   (let ( (fn (dired-get-filename 'verbatim t)) )
+     (and fn (my-file-name-tmp-p fn)) )
+   "backup file"
+   )
+  )
+
+(define-key dired-mode-map (kbd "`") 'my-dired-flag-tmp-files)
+
 ;;; ----------------------------------------------------------------
 ;;; ls-lisp, dired ls.
 
@@ -815,29 +833,22 @@
   "Face for showing TABs."
   :group 'basic-faces)
 
-(defface my-conflict-face
+(defface my-contrasty-face
   '((t :background "pink" :foreground "red" :weight bold))
   "Font for showing conflicts."
   :group 'basic-faces)
 
-(add-hook 'font-lock-mode-hook (function (lambda ()
-  (when (member major-mode my-devel-mode-list)
-    (font-lock-add-keywords nil
-     '(
-       ("\t+" 0 'my-tab-face t)
-       ("\\<\\(FIXME:?\\|XXX:?\\|TODO:?\\)\\>" 1 'font-lock-warning-face t)
-       ("\\(=\\|<\\|>\\)\\{7,\\}" 0 'my-conflict-face t)
-       ))))))
-
-;; (dolist (mode '(c-mode
-;;                 java-mode
-;;                 cperl-mode
-;;                 html-mode-hook
-;;                 css-mode-hook
-;;                 emacs-lisp-mode))
-;;   (font-lock-add-keywords mode
-;;                           '(("\\(XXX\\|FIXME\\|TODO\\)"
-;;                              1 font-lock-warning-face prepend))))
+(dolist (mode my-devel-mode-list)
+  (font-lock-add-keywords
+   mode
+   '(
+     ("\t+" 0 'my-tab-face t)
+     ("\\<\\(FIXME:?\\|XXX:?\\|TODO:?\\)\\>" 1 'font-lock-warning-face t)
+     ("\\(=\\|<\\|>\\)\\{7,\\}" 0 'my-contrasty-face t)
+     ;; 64 times, for highlight C-u C-u C-u <key>
+     ("\\([^[:space:]]\\)\\1\\{63\\}" 0 'my-contrasty-face t)
+     ))
+  )
 
 ;;; ----------------------------------------------------------------
 ;;; communication.
@@ -1033,12 +1044,29 @@
   (global-semantic-stickyfunc-mode -1)
   (global-semantic-idle-completions-mode -1)
 
+  (setq semantic-idle-scheduler-work-idle-time 60)
+  ;; (setq semantic-idle-work-parse-neighboring-files-flag nil)
+
   ;; semantic-dependency-system-include-path, semantic-customize-system-include-path
   (setq-mode-local c-mode semanticdb-find-default-throttle '(project unloaded system recursive))
   (add-hook 'c-mode-hook (lambda nil (semantic-add-system-include "~/.emacs.d/include" 'c-mode)))
   (add-hook 'c-mode-hook (lambda nil (semantic-add-system-include "~/.emacs.d/include" 'c++-mode)))
+  (require 'semanticdb)
   (global-semanticdb-minor-mode 1)
 
+  (unless (equal cedet-version "1.0pre7") ; Come with Emacs 23.2.
+    (require 'ede-locate)
+    (when (cedet-idutils-version-check t)
+      (add-to-list 'ede-locate-setup-options 'ede-locate-idutils)
+      )
+    (when (cedet-gnu-global-version-check t)
+      (add-to-list 'ede-locate-setup-options 'ede-locate-global)
+      (semanticdb-enable-gnu-global-databases 'c-mode)
+      (semanticdb-enable-gnu-global-databases 'c++-mode)
+      )
+    )
+
+  (require 'semantic-ia)
   (global-set-key (kbd "C-c , .") 'semantic-ia-fast-jump)
   (global-set-key (kbd "C-c , d") 'semantic-ia-show-doc)
   (global-set-key (kbd "C-c , D") 'semantic-ia-describe-class)