Thank you all for this great wiki!
So I want to contribute. No magic here. But maybe you can make some use of it…
Problem: On an error the init file is not evaluated any further. Also to find the source of an error I need to restart emacs with --debug-init.
The common emacswiki solutions can be found on DebugFileLoading.
This works for me: Use the follwing function instead of
(load filename) - if loading fails you will get an error message in Warnings and evaulation does not stop.
; using in Emacs 24.0. (defun solidload (filename) (condition-case err (load filename) (error (display-warning 'initialization (concat "Load of " filename " failed " (prin1-to-string err) ) :warning) ) ) )
So my .emacs file simply contains the definition of
(solidload) and a list of calls like:
(solidload "conf-common.el") (solidload "conf-keys.el") (solidload "conf-functions.el") (solidload "conf-theme.el") (solidload "conf-minor-yasnippet.el") (solidload "conf-mode-isearch.el") (solidload "conf-mode-ibuffer.el") (solidload "conf-mode-dired.el") (solidload "conf-mode-elisp.el") ...
Problem: Sometimes my cursor stops - and jumps a moment later - while I am holding the movement keys. That makes Zarza rrrrrrreally angry. Besides it’s quite irritating, especially because I am smooth scrolling (one line at a time).
The common emacswiki solution: do not use
‘scroll-step’ to activate smooth scrolling but
(setq scroll-conservatively 10000) (see SmoothScrolling).
This works for me: Set
‘auto-save-interval’ to a higher value.
The common emacswiki solution did not work for me. My cursor jumped even during non-scrolling-moves. I noticed a short hard-drive activity when the cursor got stuck. My value for
‘auto-save-interval’ was set to 50 chars.
So now I’m using:
; using in Emacs 24.0. ; Autosave every 500 typed characters (setq auto-save-interval 500) ; Autosave after 5 seconds of idle time (setq auto-save-timeout 5) ; Scroll just one line when hitting bottom of window (setq scroll-conservatively 10000)
This one changes the cursor color on each blink. Just eval code and its running.
; Using in Emacs 24.0 (defvar blink-cursor-colors (list "#92c48f" "#6785c5" "#be369c" "#d9ca65") "On each blink the cursor will cycle to the next color in this list.") (setq blink-cursor-count 0) (defun blink-cursor-timer-function () "Cyberpunk variant of timer `blink-cursor-timer'. OVERWRITES original version in `frame.el'. This one changes the cursor color on each blink. Define colors in `blink-cursor-colors'." (when (not (internal-show-cursor-p)) (when (>= blink-cursor-count (length blink-cursor-colors)) (setq blink-cursor-count 0)) (set-cursor-color (nth blink-cursor-count blink-cursor-colors)) (setq blink-cursor-count (+ 1 blink-cursor-count)) ) (internal-show-cursor nil (not (internal-show-cursor-p))) )
This one loads one of two themes depending on current time. Change
‘color-theme-day’ to the color-theme functions of your choice.
; Using in Emacs 24.0 (defvar night-hour 18 "When to start with dark theme.") (defvar day-hour 11 "When to start with light theme.") (defun color-theme-timer () "Sets color theme according to current time. Customize `night-hour' and `day-hour'." (interactive) (let ((hour (nth 2 (decode-time))) (minute (nth 1 (decode-time)))) (if (or (>= hour night-hour) (< hour day-hour) ) (color-theme-night) (color-theme-day))))
My config runs
‘color-theme-timer’ on emacs start. Thats enough for me. To get an automatic toggle when day-hour/night-hour has come, you could add
‘color-theme-timer’ to some hook that is called quite frequently, maybe
‘auto-save-hook’. Then you have to modify
‘color-theme-timer’, so it only sets the theme if it is not already active - or the screen flashes. Flash! Aaa-aaah!
I think a good way to check which theme is active is by using the background-mode of a theme as in my toggle-function:
; Using in Emacs 23.2. (defun toggle-color-theme () "Toggles day/night theme." (interactive) (let ((bgmode (cdr (assoc 'background-mode default-frame-alist)))) (if (eq bgmode 'dark) (color-theme-day) (color-theme-night))))
King Xah suggests a function to lookup the definition of the word under cursor. Here’s a copy:
; by Xah - http://xahlee.org/emacs/emacs_lookup_ref.html (defun lookup-word-definition () "Look up the current word's definition in a browser. If a region is active (a phrase), lookup that phrase." (interactive) (let (myword myurl) (setq myword (if (and transient-mark-mode mark-active) (buffer-substring-no-properties (region-beginning) (region-end)) (thing-at-point 'symbol))) (setq myword (replace-regexp-in-string " " "%20" myword)) (setq myurl (concat "http://www.answers.com/main/ntquery?s=" myword)) (browse-url myurl) ;; (w3m-browse-url myurl) ;; if you want to browse using w3m )) (global-set-key (kbd "<f6>") 'lookup-word-definition)
With the above, pressing F6 will launch your browser and lookup definition of the word under cursor.
My version (with humble respect):
; Using in Emacs 23.2. (defun lookup-word-definition (url) "Look up the current word's definition in a browser. If a region is active (a phrase), lookup that phrase. Give url of website to look up. Place <SearchWord> into url as in http://www.google.de/search?q=<SearchWord>" (interactive) (let (myword myurl currentmode) (setq myword (if (and transient-mark-mode mark-active) (buffer-substring-no-properties (region-beginning) (region-end)) (thing-at-point 'symbol))) (setq myword (replace-regexp-in-string " " "%20" myword)) (setq myurl (replace-regexp-in-string "\<SearchWord\>" myword url)) (browse-url myurl) ;; (w3m-browse-url myurl) ;; if you want to browse using w3m ))
I made these changes because I want one key to bind them all:
; In elisp mode: use f1 to search on emacswiki (C-h helps me with lisp-stuff) (define-key emacs-lisp-mode-map (kbd "<f1>") '(lambda() (interactive) (lookup-word-definition "http://www.google.com/#&q=<SearchWord>+site:www.emacswiki.org%2Femacs-en"))) ; In Autohotkey mode: use f1 to search ahk-helpsite (define-key ahk-mode-map (kbd "<f1>") '(lambda() (interactive) (lookup-word-definition "http://www.autohotkey.com/docs/commands/<SearchWord>.htm"))) ; Search google by default (global-set-key (kbd "<f1>") '(lambda() (interactive) (lookup-word-definition "http://www.google.de/search?q=<SearchWord>")))
You can easily add your own modes, eg
‘erc-header-line’face only applies to the text, not the whole line. So I tried to fill the line with empty text using
erc-header-line-format "(some vars) %-"as in
‘mode-line-format’, but unfortulately %- does not compute here.
Thanks for visiting! - Zarza
Welcome to the wiki. – DrewAdams
XEmacs had per-buffer faces. I used that to make the active buffer brighter than the inactive ones. It was great! I miss that feature in Emacs. There’s some approximation with buffer-local faces and/or overlays but neither is quite clean. Hm, I just searched EmacsWiki and found FacesPerBuffer. Looks promising! Here's an attempt at changing background color for the active buffer. For ERC, it looks like it uses
‘header-line’ instead of
‘erc-header-line’. Thank you for your auto-save trick for scrolling; I’ve been so annoyed by that. --AmitPatel