Set margin only for desired modes! Do not frustrate calendar any more.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 14 Mar 2010 18:54:20 +0200
changeset 333 14b07ca8335a
parent 332 fe7a197bebe4
child 334 d426b23b3894
Set margin only for desired modes! Do not frustrate calendar any more. Also set margin to 4 lines as continent see more next strings. My grouped lists of modes was placed at top. Do not change default-major-mode from fundamental-mode. When it was set to text-mode text-mode-hook have affect on calendar mode and when margin was set in hook it also set in calendar.
.emacs-my
--- a/.emacs-my	Fri Mar 12 21:48:36 2010 +0200
+++ b/.emacs-my	Sun Mar 14 18:54:20 2010 +0200
@@ -18,6 +18,27 @@
 ;; Set the debug option to enable a backtrace when a problem occurs.
 (setq debug-on-error nil)               ; t/nil
 
+;; ----------------------------------------------------------------------
+;; mode groups
+
+(defvar my-devel-mode-list
+  '(sh-mode script-mode java-mode c-mode
+            lisp-mode makefile-mode makefile-gmake-mode python-mode)
+  "List of development modes.")
+
+(defvar my-devel-mode-hook-list
+  '(sh-mode-hook script-mode-hook java-mode-hook c-mode-hook
+            lisp-mode-hook makefile-mode-hook makefile-gmake-mode-hook python-mode-hook)
+  "List of development mode hooks.")
+
+(defvar my-text-mode-list
+  '(outline-mode text-mode)
+  "List of text modes.")
+
+(defvar my-text-mode-hook-list
+  '(outline-mode-hook text-mode-hook)
+  "List of text mode hooks.")
+
 ;; ======================================================================
 ;; appearance.
 
@@ -113,11 +134,15 @@
 (setq-default
  scroll-step 1
  scroll-conservatively 100
- ;; При перемещении точка останавливается на расстоянии i строк к границе фрейма.
- scroll-margin 2
  scroll-preserve-screen-position t
  )
 
+;; Set margin only for desired modes! Do not frustrate calendar any more.
+(make-variable-buffer-local 'scroll-margin)
+(mapc (lambda (hook) (add-hook hook (lambda nil (setq scroll-margin 4))))
+      (delete-dups (append my-text-mode-hook-list my-devel-mode-hook-list
+                           '(recentf-mode-hook))) )
+
 ;; ----------------------------------------------------------------------
 ;; searching.
 
@@ -131,10 +156,6 @@
 (global-set-key [f7] 'occur)            ; Key binding as in mc
 
 ;; ----------------------------------------------------------------------
-;; *Text*
-(setq default-major-mode 'text-mode)
-
-;; ----------------------------------------------------------------------
 ;; syntax highlighting.
 
 (setq font-lock-maximum-decoration t)
@@ -652,11 +673,6 @@
   "Font for showing conflicts."
   :group 'basic-faces)
 
-(defvar my-devel-mode-list
-  '(sh-mode script-mode java-mode c-mode outline-mode text-mode
-            lisp-mode makefile-mode makefile-gmake-mode python-mode)
-  "List of development modes." )
-
 (add-hook 'font-lock-mode-hook (function (lambda ()
   (when (member major-mode my-devel-mode-list)
     (font-lock-add-keywords nil