-
Notifications
You must be signed in to change notification settings - Fork 5
/
.emacs
90 lines (81 loc) · 3.92 KB
/
.emacs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
(defun replace-accents-html ()
(interactive)
(replace-string "á" "á" nil (point-min) (point-max))
(replace-string "é" "é" nil (point-min) (point-max))
(replace-string "í" "í" nil (point-min) (point-max))
(replace-string "ó" "ó" nil (point-min) (point-max))
(replace-string "ú" "ú" nil (point-min) (point-max))
(replace-string "ñ" "ñ" nil (point-min) (point-max))
(replace-string "Á" "Á" nil (point-min) (point-max))
(replace-string "É" "É" nil (point-min) (point-max))
(replace-string "Í" "Í" nil (point-min) (point-max))
(replace-string "Ó" "Ó" nil (point-min) (point-max))
(replace-string "Ú" "Ú" nil (point-min) (point-max))
(replace-string "Ñ" "Ñ" nil (point-min) (point-max)))
(defun replace-accents-ascii ()
(interactive)
(replace-string "á" "a" nil (point-min) (point-max))
(replace-string "é" "e" nil (point-min) (point-max))
(replace-string "í" "i" nil (point-min) (point-max))
(replace-string "ó" "o" nil (point-min) (point-max))
(replace-string "ú" "u" nil (point-min) (point-max))
(replace-string "ñ" "n" nil (point-min) (point-max))
(replace-string "Á" "A" nil (point-min) (point-max))
(replace-string "É" "E" nil (point-min) (point-max))
(replace-string "Í" "I" nil (point-min) (point-max))
(replace-string "Ó" "O" nil (point-min) (point-max))
(replace-string "Ú" "U" nil (point-min) (point-max))
(replace-string "Ñ" "N" nil (point-min) (point-max)))
(defun replace-accents-latex ()
(interactive)
(replace-string "á" "\\'{a}" nil (point-min) (point-max))
(replace-string "é" "\\'{e}" nil (point-min) (point-max))
(replace-string "í" "\\'{\\i}" nil (point-min) (point-max))
(replace-string "ó" "\\'{o}" nil (point-min) (point-max))
(replace-string "ú" "\\'{u}" nil (point-min) (point-max))
(replace-string "ñ" "\\~{n}" nil (point-min) (point-max))
(replace-string "Á" "\\'{A}" nil (point-min) (point-max))
(replace-string "É" "\\'{E}" nil (point-min) (point-max))
(replace-string "Í" "\\'{\\I}" nil (point-min) (point-max))
(replace-string "Ó" "\\'{O}" nil (point-min) (point-max))
(replace-string "Ú" "\\'{U}" nil (point-min) (point-max))
(replace-string "Ñ" "\\~{N}" nil (point-min) (point-max)))
(add-hook 'LaTeX-mode-hook
'(lambda ()
(setq ispell-tex-skip-alists
(list
(append
(car ispell-tex-skip-alists)
'(("[^\\]\\$" . "[^\\]\\$")))
(cadr ispell-tex-skip-alists))) ))
(put 'downcase-region 'disabled nil)
(defun find-next-unsafe-char (&optional coding-system)
"Find the next character in the buffer that cannot be encoded by
coding-system. If coding-system is unspecified, default to the coding
system that would be used to save this buffer. With prefix argument,
prompt the user for a coding system."
(interactive "Zcoding-system: ")
(if (stringp coding-system) (setq coding-system (intern coding-system)))
(if coding-system nil
(setq coding-system
(or save-buffer-coding-system buffer-file-coding-system)))
(let ((found nil) (char nil) (csets nil) (safe nil))
(setq safe (coding-system-get coding-system 'safe-chars))
;; some systems merely specify the charsets as ones they can encode:
(setq csets (coding-system-get coding-system 'safe-charsets))
(save-excursion
;;(message "zoom to <")
(let ((end (point-max))
(here (point ))
(char nil))
(while (and (< here end) (not found))
(setq char (char-after here))
(if (or (eq safe t)
(< char ?\177)
(and safe (aref safe char))
(and csets (memq (char-charset char) csets)))
nil ;; safe char, noop
(setq found (cons here char)))
(setq here (1+ here))) ))
(and found (goto-char (1+ (car found))))
found))