I am using emacs 23.2 with the GTK toolkit. I built emacs from source using the following configure-params:
./configure --prefix=/usr --without-makeinfo --without-sound
Which builds emacs with the following configuration:
Where should the build process find the source code? /home/****/incoming/emacs-23.2
What operating system and machine description files should Emacs use?
`s/gnu-linux.h' and `m/intel386.h'
What compiler should emacs be built with? gcc -g -O2 -Wdeclaration-after-statement -Wno-pointer-sign
Should Emacs use the GNU version of malloc? yes
(Using Doug Lea's new malloc from the GNU C Library.)
Should Emacs use a relocating allocator for buffers? yes
Should Emacs use mmap(2) for buffer allocation? no
What window system should Emacs use? x11
What toolkit should Emacs use? GTK
Where do we find X Windows header files? Standard dirs
Where do we find X Windows libraries? Standard dirs
Does Emacs use -lXaw3d? no
Does Emacs use -lXpm? yes
Does Emacs use -ljpeg? yes
Does Emacs use -ltiff? yes
Does Emacs use a gif library? yes -lgif
Does Emacs use -lpng? yes
Does Emacs use -lrsvg-2? no
Does Emacs use -lgpm? yes
Does Emacs use -ldbus? yes
Does Emacs use -lgconf? no
Does Emacs use -lfreetype? yes
Does Emacs use -lm17n-flt? no
Does Emacs use -lotf? yes
Does Emacs use -lxft? yes
Does Emacs use toolkit scroll bars? yes
My OS is OpenSuSE 11.1, GTK version is 2.14.4.
When I'm scrolling within files of a common size (about 1000 lines) holding the up/down-keys, emacs almost hangs and produces about 50% CPU-load. I use the following plugins:
ido
linum
tabbar
auto-complete-config
Starting emacs with -q fixes the problem, but then I don't have any plugins. I can't figure out, which part of my .emacs is responsible for this behaviour.
Here's an excerpt of my .emacs-file:
(require 'ido)
(ido-mode 1)
(require 'linum)
(global-linum-mode 1)
(require 'tabbar)
(tabbar-mode 1)
(tabbar-local-mode 0)
(tabbar-mwheel-mode 0)
(setq tabbar-buffer-groups-function
(lambda ()
(list "All")))
(global-set-key [M-left] 'tabbar-backward)
(global-set-key [M-right] 'tabbar-forward)
;; hide the toolbar (gtk etc.)
(tool-bar-mode -1)
;; Mouse scrolling enhancements
(setq mouse-wheel-progressive-speed nil)
(setq mouse-wheel-scroll-amount '(5 ((shift) . 5) ((control) . nil)))
;; Smart-HOME
(defun smart-beginning-of-line ()
"Forces the cursor to jump to the first none whitespace char of the current line when pressing HOME"
(interactive)
(let ((oldpos (point)))
(back-to-indentation)
(and (= oldpos (point))
(beginning-of-line))))
(put 'smart-beginning-of-line 'CUA 'move)
(global-set-key [home] 'smart-beginning-of-line)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(column-number-mode t)
'(cua-mode t nil (cua-base))
'(custom-buffer-indent 4)
'(delete-selection-mode nil)
'(display-time-24hr-format t)
'(display-time-day-and-date 1)
'(display-time-mode t)
'(global-font-lock-mode t nil (font-lock))
'(inhibit-startup-buffer-menu t)
'(inhibit-startup-screen t)
'(pc-select-meta-moves-sexps t)
'(pc-select-selection-keys-only t)
'(pc-selection-mode t nil (pc-select))
'(scroll-bar-mode (quote right))
'(show-paren-mode t)
'(standard-indent 4)
'(uniquify-buffer-name-style (quote forward) nil (uniquify)))
(setq-default tab-width 4)
(setq-default indent-tabs-mode t)
(setq c-basic-offset 4)
;; Highlighting of the current line
(global-hl-line-mode 1)
(set-face-background 'hl-line "#E8F2FE")
(defalias 'yes-or-no-p 'y-or-n-p)
(display-time)
(set-language-environment "Latin-1")
;; Change cursor color according to mode
(setq djcb-read-only-color "gray")
;; valid values are t, nil, box, hollow, bar, (bar . WIDTH), hbar,
;; (hbar. HEIGHT); see the docs for set-cursor-type
(setq djcb-read-only-cursor-type 'hbar)
(setq djcb-overwrite-color "red")
(setq djcb-overwrite-cursor-type 'box)
(setq djcb-normal-color "black")
(setq djcb-normal-cursor-type 'bar)
(defun djcb-set-cursor-according-to-mode ()
"change cursor color and type according to some minor modes."
(cond
(buffer-read-only
(set-cursor-color djcb-read-only-color)
(setq cursor-type djcb-read-only-cursor-type))
(overwrite-mode
(set-cursor-color djcb-overwrite-color)
(setq cursor-type djcb-overwrite-cursor-type))
(t
(set-cursor-color djcb-normal-color)
(setq cursor-type djcb-normal-cursor-type))))
(add-hook 'post-command-hook 'djcb-set-cursor-according-to-mode)
(define-key global-map '[C-right] 'forward-sexp)
(define-key global-map '[C-left] 'backward-sexp)
(define-key global-map '[s-left] 'windmove-left)
(define-key global-map '[s-right] 'windmove-right)
(define-key global-map '[s-up] 'windmove-up)
(define-key global-map '[s-down] 'windmove-down)
(define-key global-map '[S-down-mouse-1] 'mouse-stay-and-copy)
(define-key global-map '[C-M-S-down-mouse-1] 'mouse-stay-and-swap)
(define-key global-map '[S-mouse-2] 'mouse-yank-and-kill)
(define-key global-map '[C-S-down-mouse-1] 'mouse-stay-and-kill)
(define-key global-map "\C-a" 'mark-whole-buffer)
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:inherit nil :stipple nil :background "#f7f9fa" :foreground "#191919" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono"))))
'(font-lock-builtin-face ((((class color) (min-colors 88) (background light)) (:foreground "#642880" :weight bold))))
'(font-lock-comment-face ((((class color) (min-colors 88) (background light)) (:foreground "#3f7f5f"))))
'(font-lock-constant-face ((((class color) (min-colors 88) (background light)) (:weight bold))))
'(font-lock-doc-face ((t (:inherit font-lock-string-face :foreground "#3f7f5f"))))
'(font-lock-function-name-face ((((class color) (min-colors 88) (background light)) (:foreground "Black" :weight bold))))
'(font-lock-keyword-face ((((class color) (min-colors 88) (background light)) (:foreground "#7f0055" :weight bold))))
'(font-lock-preprocessor-face ((t (:inherit font-lock-builtin-face :foreground "#7f0055" :weight bold))))
'(font-lock-string-face ((((class color) (min-colors 88) (background light)) (:foreground "#0000c0"))))
'(font-lock-type-face ((((class color) (min-colors 88) (background light)) (:foreground "#7f0055" :weight bold))))
'(font-lock-variable-name-face ((((class color) (min-colors 88) (background light)) (:foreground "Black"))))
'(minibuffer-prompt ((t (:foreground "medium blue"))))
'(mode-line ((t (:background "#222222" :foreground "White"))))
'(tabbar-button ((t (:inherit tabbar-default :foreground "dark red"))))
'(tabbar-button-highlight ((t (:inherit tabbar-default :background "white" :box (:line-width 2 :color "white")))))
'(tabbar-default ((t (:background "gray90" :foreground "gray50" :box (:line-width 3 :color "gray90") :height 100))))
'(tabbar-highlight ((t (:underline t))))
'(tabbar-selected ((t (:inherit tabbar-default :foreground "blue" :weight bold))))
'(tabbar-separator ((t nil)))
'(tabbar-unselected ((t (:inherit tabbar-default)))))
Any suggestions?
Kind regards,
mefiX
Looks OK to me. The fact that it runs OK with emacs -q is key, since it means you can solve the problem.
Now, I hope that someone offers you a simple diagnosis based on your files, but if not (and hey it's been 7 hours), you can always try the standard .emacs-debugging slow coach. It's not particularly fun, but it'll work.
Chose your pleasure:
(A) Divide and Conquer
Divide your .emacs mentally into 4 parts. Now figure out which quarter is causing your problem by making four separate trial emacs configs: the first with 1/4 of your emacs, the next with half, the next with three quarters, and the final one with everything.
emacs --no-site-file # see if the problem is in your site-wide emacs init
emacs -q -l config1 # is it in the first quarter
emacs -q -l config2 # is it in the first half (i.e. the second quarter)
emacs -q -l config3 # is it in the third quarter
emads -q -l config4 # gotta be here, but test again to be sure
If you don't find the culprit, you can further divide. If you suspect you have a culprit, or just like the look of this method better, try this:
(B) Check each step
load a blank emacs with emacs -q
visit your .emacs in a buffer
visit your 1K line file in another buffer.
use eval-last-sexp C-x C-e, or eval-region to try each section or line in your .emacs, either systematically from the beginning, or starting with any suspect function calls.
Slowly but surely, you'll smoke it out. Sorry I can't offer you instant diagnosis.
In my experience, turning off linum mode solves problem with scroll freeze.
I had the same problem with emacs 24. Turned out to be tabbar-mode that slowed it down.
Related
Ok, so my org-mode latex fragments have a slightly off background color, but only when I:
(setq org-highlight-latex-and-related '(native))
As seen here
It looks similar to the background highlighting functionality as involved in ~~ (code).
Does anyone know what to do?
BONUS:
I'm using doom emacs and the gruvbox theme.
TRIED:
I don't think this is related to the fragments themselves a la org-format-latex-options (as seen in many other posts)
This is NOT helped by setting font-latex-math-face :background
HINTS:
I feel like it IS related to the face org-latex-and-related, but I can work out how the chance the background, when I 'customise' the face i get the following:
(defface org-latex-and-related
(let ((font (cond ((assq :inherit custom-face-attributes)
'(:inherit underline))
(t '(:underline t)))))
`((((class grayscale) (background light))
(:foreground "DimGray" ,#font))
(((class grayscale) (background dark))
(:foreground "LightGray" ,#font))
(((class color) (background light))
(:foreground "SaddleBrown"))
(((class color) (background dark))
(:foreground "burlywood"))
(t (,#font))))
"Face used to highlight LaTeX data, entities and sub/superscript."
:group 'org-faces
:version "24.4"
:package-version '(Org . "8.0"))
Answering my own question.
As usual, tecosaur got there first and gives a good breakdown of the internals.
The code that does the magic is
(require 'org-src)
(add-to-list 'org-src-block-faces '("latex" (:inherit default :extend t)))
I am trying to change the background color of R code blocks in Org-mode 8. In Org-mode 7, I was able to use:
(defface org-block-background
'((t (:background "#dadada")))
"Face used for the source block background.")
But the org-block-background variable seems to have disappeared in version 8...?
I tried:
(defface org-block
'((t (:background "#dadada")))
"Face used for the source block background.")
which works for:
#+BEGIN_SRC
#+END_SRC
and
#+BEGIN_latex
#+END_latex
But for some reason, the background color disappears, the moment I specify a language, e.g...
#+BEGIN_SRC R
#+END_SRC
I am working on a mac, running Emacs 24.3 and have upgraded org-mode to v8, using:
cd ~/.emacs.d/lisp
git clone git://orgmode.org/org-mode.git
cd org-mode
make autoloads
make
make doc
Here is the config from my init.el file:
;;;----- Startup ----------------------------;
;;; Add src directory to path
(add-to-list 'load-path "~/.emacs.d/lisp/")
;;;----- Org-Mode ---------------------------;
;;; Add upgraded org-mode to load path
(add-to-list 'load-path "~/.emacs.d/lisp/org-mode/lisp")
(add-to-list 'load-path "~/.emacs.d/lisp/org-mode/contrib/lisp" t)
;;; fontify code in code blocks
(setq org-src-fontify-natively t)
(defface org-block-begin-line
'((t (:foreground "#666666" :background "#dadada")))
"Face used for the line delimiting the begin of source blocks.")
(defface org-block
'((t (:background "#dadada")))
"Face used for the source block background.")
(defface org-block-end-line
'((t (:foreground "#666666" :background "#dadada")))
"Face used for the line delimiting the end of source blocks.")
(require 'org)
;;;----- ESS/R ------------------------------;
(add-to-list 'load-path "~/.emacs.d/lisp/ess/lisp/")
(load "ess-site")
;;;------ Babel ------------------------------;
;;; Support R
(org-babel-do-load-languages
'org-babel-load-languages
'((R . t)
(latex . t)))
;;;----- Look & feel ----------------------------;
;;; Set default theme
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'solarized-light t)
Any ideas?
Thanks!
FYI, this will not work for current versions of Org Mode (from the Git master branch), after this commit http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=f8b42e8 - at least until something changes. This is announced here (July, 2014) and continues to be in effect for Org Mode users, e.g. see here (April, 2015). Anyone dedicated to restoring the old behavior locally might be able to do it from the commit's diff - I haven't tried. Future versions of Org Mode may restore the feature, possibly going about it in a different way. For now, this is about all you can get:
(The first SRC block above gets a background from my setting for org-block.)
Turns out org-block-background face has been removed in org version 8.3.1 in commit f8b42e8, thus the bug. The rationale seems to be
it causes a bug with ps export
it's inefficient
Maybe in the future there will be an alternative, but not yet.
Fontify R code blocks in Org-mode 8
https://lists.gnu.org/archive/html/emacs-orgmode/2015-08/msg00510.html
Currently it seems the only way to get the old behavior back is to manually reverse the changes introduced in commit f8b42e8. You can see the commit here:
http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=f8b42e8
diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index e693dab..83453e8 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
## -537,9 +537,6 ## follows a #+DATE:, #+AUTHOR: or #+EMAIL: keyword."
:group 'org-faces
:version "22.1")
-(defface org-block-background '((t ()))
- "Face used for the source block background.")
-
(org-copy-face 'org-meta-line 'org-block-begin-line
"Face used for the line delimiting the begin of source blocks.")
diff --git a/lisp/org.el b/lisp/org.el
index a153151..7e30061 100644
--- a/lisp/org.el
+++ b/lisp/org.el
## -5930,15 +5930,7 ## by a #."
(cond
((and lang (not (string= lang "")) org-src-fontify-natively)
(org-src-font-lock-fontify-block lang block-start block-end)
- ;; remove old background overlays
- (mapc (lambda (ov)
- (if (eq (overlay-get ov 'face) 'org-block-background)
- (delete-overlay ov)))
- (overlays-at (/ (+ beg1 block-end) 2)))
- ;; add a background overlay
- (setq ovl (make-overlay beg1 block-end))
- (overlay-put ovl 'face 'org-block-background)
- (overlay-put ovl 'evaporate t)) ; make it go away when empty
+ (add-text-properties beg1 block-end '(src-block t)))
(quoting
(add-text-properties beg1 (min (point-max) (1+ end1))
'(face org-block))) ; end of source block
## -21828,9 +21820,7 ## and end of string."
When INSIDE is non-nil, don't consider we are within a src block
when point is at #+BEGIN_SRC or #+END_SRC."
(let ((case-fold-search t) ov)
- (or (and (setq ov (overlays-at (point)))
- (memq 'org-block-background
- (overlay-properties (car ov))))
+ (or (and (eq (get-char-property (point) 'src-block) t))
(and (not inside)
(save-match-data
(save-excursion
I figured it out. Turns out I had cloned an old branch of org-mode which was missing the org-block-background variable! Deleted my org-mode folder and reinstalled using:
cd ~/.emacs.d/lisp
git clone https://github.com/Konubinix/org-mode.git
cd org-mode
make autoloads
make
make doc
Then revised my init.el to read:
;;;----- Org-Mode ---------------------------;
;;; Add upgraded org-mode to load path
(add-to-list 'load-path "~/.emacs.d/lisp/org-mode/lisp")
(add-to-list 'load-path "~/.emacs.d/lisp/org-mode/contrib/lisp" t)
;;; fontify code in code blocks
(setq org-src-fontify-natively t)
(defface org-block-begin-line
'((t (:foreground "#666666" :background "#dadada")))
"Face used for the line delimiting the begin of source blocks.")
(defface org-block
'((t (:background "#dadada")))
"Face used for the source block background.")
(defface org-block-background
'((t (:background "#dadada")))
"Face used for the source block background.")
(defface org-block-end-line
'((t (:foreground "#666666" :background "#dadada")))
"Face used for the line delimiting the end of source blocks.")
(require 'org)
And presto!
I'm a long time (26 years) Emacs user, all the way from TECO Emacs to GNU Emacs 23.4 for MacOS X. I can hack Lisp macros and usually find my way around.
Emacs has become very big. And very colorful.
Is there a simple way to make sure that Emacs never changes font size or color ever?
You can turn off all font colours and other decorations with the following line in your .emacs:
(global-font-lock-mode 0)
Emacs has some highlighting that is not controlled by font-lock-mode.
Here is a solution posted by Juri Linkov to the Emacs Dev mailing list, back in 2007:
I use the following trick to post-process faces immediately after they
get created. I also modified this code to not reset mode line faces:
(defun my-faces-fix (&optional frame)
"Fix defined faces."
(interactive)
;; Check if this function is called by `custom-define-hook' from
;; `custom-declare-face' where the variable `face' is bound locally.
(when (boundp 'face)
(dolist (face (face-list))
(unless (memq face '(mode-line mode-line-highlight mode-line-inactive))
;; Reset all face attributes
(modify-face face)))))
;; 1. Fix existing faces
(let ((face t)) (my-faces-fix))
;; 2. Call `my-faces-fix' every time some new face gets defined
(add-to-list 'custom-define-hook 'my-faces-fix)
Here's what I've been using for two years now:
(custom-set-faces
'(default ((t (:inherit nil :height 113 :family "DejaVu Sans Mono"))))
'(font-lock-builtin-face ((nil (:foreground "#7F0055" :weight bold))))
'(font-lock-keyword-face ((nil (:foreground "#7F0055" :weight bold))))
'(font-lock-comment-face ((nil (:foreground "#3F7F5F"))))
'(font-lock-string-face ((nil (:foreground "#2A00FF"))))
'(font-lock-type-face ((t (:underline t :slant italic :foreground "#000000"))))
'(font-lock-constant-face ((t (:foreground "#110099"))))
'(font-lock-variable-name-face ((nil nil)))
'(font-lock-function-name-face ((t (:weight bold)))))
You can customize a bunch of other faces too:
just call M-x customize-face. It will auto-select
the current face.
I like maximum syntax highlighting of AucTeX, but I don't like AucTeX messing with fonts. For example, if I use italics, it shows italicized letters in my emacs buffer, and shows subscripts and superscripts in small letters (slightly above or below the line). I prefer to use a fixed width font regardless of the latex environment I am in.
I tried changing the settings for the variable font-latex-deactivated-keyword-classes, but then the syntax coloring also disappears.
Could someone suggest a way to fix this?
Thanks.
From http://www.gnu.org/software/auctex/manual/auctex/Faces.html#Faces
In case you want to change the colors and fonts used by font-latex please refer to the faces mentioned in the explanations above and use M-x customize-face RET <face> RET. All faces defined by font-latex are accessible through a customization group by typing
M-x customize-group RET font-latex-highlighting-faces RET.
The above command opens the settings buffer where you can set the appropriate font face. Once you save changes, your .emacs file will contain a line similar to:
'(font-latex-sectioning-5-face ((((class color) (background light))
(:inherit variable-pitch :foreground "blue4" :weight normal :foundry
"outline" :family "Century Gothic")
In your example, you can customize the Font Latex Italic Face to your specifications. Your .emacs should then contain
'(font-latex-italic-face ...)
to whatever you set it to. You can similarly customize superscript, subscript and whole host of other font faces.
In recent versions of AUCTeX:
(setq font-latex-fontify-script nil)
(setq font-latex-fontify-sectioning 'color)
See this page in the manual and the section Deactivating defaults of built-in keyword classes.
Tested on Emacs 24.3. Put the following in your ~/.emacs file:
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(font-latex-bold-face ((t nil)))
'(font-latex-doctex-documentation-face ((t nil)))
'(font-latex-doctex-preprocessor-face ((t nil)))
'(font-latex-italic-face ((t nil)))
'(font-latex-math-face ((t nil)))
'(font-latex-sectioning-0-face ((t nil)))
'(font-latex-sectioning-1-face ((t nil)))
'(font-latex-sectioning-2-face ((t nil)))
'(font-latex-sectioning-3-face ((t nil)))
'(font-latex-sectioning-4-face ((t nil)))
'(font-latex-sectioning-5-face ((t nil)))
'(font-latex-sedate-face ((t nil)))
'(font-latex-slide-title-face ((t nil)))
'(font-latex-string-face ((t nil)))
'(font-latex-subscript-face ((t nil)))
'(font-latex-superscript-face ((t nil)))
'(font-latex-verbatim-face ((t nil)))
'(font-latex-warning-face ((t nil))))
I'm getting the error Unable to load color "unspecified-bg" [16 times] when using emacsclient -c. I've started up emacs using emacs --daemon. This seems to mean that my custom faces won't load.
When starting emacs as usual, and then using M-x server-start, then this problem doesn't happen at all. How can I get emacsclient -c to load the faces properly?
Here's the relevant code:
(custom-set-faces '(default ((t (:inherit nil :stipple nil :background "black" :foreground "white" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 120 :width normal :foundry "unknown" :family "Inconsolata")))))
I'm not 100% sure this would fix your problem, but you really should be using color-theme for syntax highlighting. Custom is meant for beginning emacs users, so I'd suggest you try out color-theme and see if it works. Here's how I have it set up on my machine:
Download the package from the color-theme homepage.
Put the color-theme folder somewhere like ~/.emacs.d/color-theme/.
Make sure this folder is in your load-path. I took the following code from a Steve Yegge post:
In your .emacs:
(defvar emacs-root "~/.emacs.d/")
(labels
((add-path
(p)
(add-to-list
'load-path
(concat emacs-root p))))
(add-path "lisp")
(add-path "color-theme-6.6.0")
(add-path "cedet-1.0"))
(require 'color-theme)
Then you define your color theme:
;; Color-theme
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
;; Set custom color theme
(defun color-theme-mine ()
"My custom color theme"
(interactive)
(set-cursor-color "#ffffff")
(color-theme-install
'(color-theme-mine
;; Super-light grey on Dark grey
((foreground-color . "#e0e0e0")
(background-color . "#151515")
(background-mode . dark))
(font-lock-comment-face ((t (:foreground "#106010")))) ;; Forest Green
;; More definitions below
;; ...
(color-theme-mine)) ;; end eval-after-load
This will load color-them-mine when you start emacs. You can see all available color themes by typing M-x color-theme <TAB>. To see the full list of faces available, use the command M-x list-faces-display.
Sounds like this might be bug #4776: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4776#5. If not, consider filing a bug report for this one, using M-x report-emacs-bug.