With a .emacs loading iimage-mode and adoc-mode:
;; Don't glare 200W in my eyes all day:
(set-foreground-color "white")
(set-background-color "black")
;; Use adoc as major mode for any file with the extension .adoc.
(require 'adoc-mode)
(setq auto-mode-alist (cons '("\\.adoc\\'" . adoc-mode) auto-mode-alist))
;; Use iimage-mode as minor mode whenever we're in adoc-mode.
(add-hook 'adoc-mode-hook 'my-adoc-mode-hook)
(defun my-adoc-mode-hook ()
"Custom `adoc-mode' behaviours."
(iimage-mode 1))
if I convert the file file.adoc
.A PNG smiley
image::smiley.png[]
to HTML using Asciidoctor
asciidoctor file.adoc
I get the nicely formatted HTML file
but Emacs shows a distracting strikethrough
How do I get rid of it?
It looks like you're running into adoc's markup fontification for internal references. I was able to make that line go away by removing the underlining from markup-internal-reference-face. Something like this added to your .emacs might fix it:
(custom-set-faces
'(markup-internal-reference-face ((t (:inherit markup-meta-face)))))
Related
When I edit a file with emacs, the configuration stored in the .emacs file is read (I can judge this by the font size). However, not a second passes and both the window and font sizes decrease. It seems that my custom configuration is being overridden. I don't know where this additional configuration is stored.
System: Light Ubuntu 18.04
My .emacs file:
(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.
'(setq tab-stop-list t))
(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 (:family "DejaVu Sans Mono" :foundry "PfEd" :slant normal :weight normal :height 143 :width normal)))))
; disable the wellcome screen
(setq inhibit-startup-screen t)
;; rebind C-x C-b to invoke buffer-menu rather than list-buffers
(global-set-key "\C-x\C-b" 'buffer-menu)
; open list of buffers in active window
(global-set-key "\C-x\C-b" 'buffer-menu)
; Directory to place the backup files
(setq backup-directory-alist `(("." . "~/.emacs.d/backup_files")))
; Disable Large file size warning
(setq large-file-warning-threshold nil)
;; show line numbers
(global-linum-mode 1)
Following #prosoitos advice from the comment's section in the original question:
created $HOME/.Xresouces file containing the following line
emacs*font: DejaVu Sans Mono 16
in the terminal, type xrdb $HOME/.Xresouces
hi: Each time I insert some text in emacs , it will highlight the newly added text. I wonder how to change the background color of the highlight, because the highlight background color is very close to the font color , as a result, I can hardly recognize the code that I am writing.
thank you soooo much
For issues with fonts (which Emacs calls faces) inside of Emacs, it is often helpfull to know the function 'list-faces-display'. You can call this with M-x and it will list all faces defined in the current frame. This can be helpfull both identifying which face is problematic, it will also give you its name which can be used to modify the face. For instance to change the foreground colour of the face named "button" you can call something like this:
(set-face-foreground 'button "cyan")
The effect will be immediately visible. Many aspects of faces can be changed, including colour, font familiy and font size.
Obviously, this will not help you if the problematic behaviour stems from the terminal emulator you are using, as it would appear from some of the comments to your question, then the problem is outside of Emacs and cannot be fixed from inside of Emacs. Even so, knowing about 'list-faces-display' is usefull.
I had this exact question and managed to solve it using the following ways. But I also had another thing in mind: a marker to show which lines are modified.
For tracking changes between the saved file and the buffer, we should use the highlight-changes-mode. But before enabling that mode, we need to prepare some stuff as explained beautifully here for the line marks:
;; a part to add the fringe marks to the gutter. To change the shape, read the explanation of it in this code.
(eval-after-load "hilit-chg"
'(progn
(defvar highlight-fringe-mark 'filled-square
"The fringe bitmap name marked at changed line.
Should be selected from `fringe-bitmaps'.")
(defadvice hilit-chg-make-ov (after hilit-chg-add-fringe activate)
(mapc (lambda (ov)
(if (overlay-get ov 'hilit-chg)
(let ((fringe-anchor (make-string 1 ?x)))
(put-text-property 0 1 'display
(list 'left-fringe highlight-fringe-mark)
fringe-anchor)
(overlay-put ov 'before-string fringe-anchor))
))
(overlays-at (ad-get-arg 1))))))
;; make the highlight-changes-mode reset when the file is saved
(add-hook 'local-write-file-hooks 'highlight-changes-rotate-faces)
(add-hook 'after-save-hook
(lambda ()
(when highlight-changes-mode
(save-restriction
(widen)
(highlight-changes-remove-highlight (point-min) (point-max))))))
make sure it is enabled globally except for buffers that start with ' and *
(setq highlight-changes-global-modes t)
(global-highlight-changes-mode)
make the mode to respect the syntax-highlighting
;; find the name of other faced using M-x ~list-faces-display~
(custom-set-faces
'(highlight-changes ((t (:background "dark green" :foreground nil)))))
(set-face-foreground 'highlight-changes nil)
(set-face-background 'highlight-changes "dark green")
I have this code in my .emacs file:
(setq-default show-trailing-whitespace t)
(setq whitespace-style '(face tabs))
(whitespace-mode)
How can I change the var whitespace-tab so my tabs look the same as trailing whitespace (red background)?
An alternative: do not bother with whitespace-mode for this.
Use library highlight-chars.el (see your related question), and just customize face hc-tab (M-x customize-face hc-tab).
Found it, need to use this code:
(setq whitespace-style '(face tabs))
(setq tab-face (make-face 'tab-face))
(set-face-background 'tab-face "red")
(setq whitespace-tab 'tab-face)
(whitespace-mode)
My emacs (Aquamacs with AucTex) changes font size (in e.g. LaTeX mode) to show the syntax - like this:
Unfortunately this ruins the point of a monospaced font - e.g. my comments do not align. How do I solve this problem?
For the specific example of sections, chapters, etc., add the following to your .emacs:
(setq font-latex-fontify-sectioning 'color)
Edit
Here is the config I usually use to customise the AUCTeX formatting:
;; Only change sectioning colour
(setq font-latex-fontify-sectioning 'color)
;; super-/sub-script on baseline
(setq font-latex-script-display (quote (nil)))
;; Do not change super-/sub-script font
(custom-set-faces
'(font-latex-subscript-face ((t nil)))
'(font-latex-superscript-face ((t nil)))
)
;; Exclude bold/italic from keywords
(setq font-latex-deactivated-keyword-classes
'("italic-command" "bold-command" "italic-declaration" "bold-declaration"))
If you find a solution to this, the beers are on me. The best I've been able to come up with so far is to put the following in my .emacs somewhere and run the function after loading a mode that does this (org-mode does it too).
(defun fix-fonts ()
(interactive)
(mapc
(lambda (face)
(set-face-attribute face nil
;; :family (if (string= system-type "darwin")
;; "Menlo"
;; "Inconsolata")
:width 'normal
:height 1.0
:weight 'normal
:underline nil
:slant 'normal))
(remove 'default (face-list))))
I don't do the family thing anymore, because I didn't have time to figure out a good way to programatically get it right and it doesn't seem to matter, but your mileage might vary. Also, I don't set anything on the "default" font because some of the other values are relative and need that fixed reference point.
this is in my .emacs can I mess with it or not?
(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.
)
(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.
'(better-fringes-bitmap ((t (:foreground "#00dd44"))))
'(font-lock-string-face ((((class color) (min-colors 88) (background light)) (:foreground "#113355")))))
so far I am adding everything I want above these lines...
These blocks are added by the customize interface, as Noufal pointed out. You can move them to a separate file, though, if you like.
Just add this to your ~/.emacs.d/init.el:
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)
or, if you're still using an old-fashioned ~/.emacs file:
(setq custom-file "~/.custom.el")
(load custom-file)
A slightly more complex snippet that will work in either case is:
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(load custom-file)
These are lines added to the file when you use the customise system. They're generated when you use customize-*. By default, the customisation options are stored in the .emacs file. You don't usually edit these by hand. You have to use the customize-* commands to edit them.
Don't add anything to these lines manually — your changes will be vanished by emacs on some events. Instead add custom variables with customize-set-variable and custom faces with set-face-attribute:
(customize-set-variable 'blink-cursor-mode nil)
(set-face-attribute 'default nil :family "DejaVu Sans Mono")
In order to customize face of some package one sometimes need to request the package first, and after that set its face:
(require 'mumamo)
(set-face-attribute 'mumamo-background-chunk-major nil :background nil)