Added a way to cycle ispell directory's.

This commit is contained in:
larstvei 2014-01-05 13:13:37 +01:00
parent 91f6939338
commit 7014e03cd3
2 changed files with 31 additions and 0 deletions

10
init.el
View File

@ -267,6 +267,15 @@ PACKAGE is installed and the current version is deleted."
(add-hook 'prog-mode-hook 'flyspell-prog-mode) (add-hook 'prog-mode-hook 'flyspell-prog-mode)
(ac-flyspell-workaround) (ac-flyspell-workaround)
(defvar ispell-languages '#1=("english" "norsk" . #1#))
(defun cycle-languages ()
"Changes the ispell-dictionary to whatever is the next (or cdr) in the
LANGUAGES (cyclic) list."
(interactive)
(ispell-change-dictionary
(car (setq ispell-languages (cdr ispell-languages)))))
(setq org-agenda-start-on-weekday nil ; Show agenda from today. (setq org-agenda-start-on-weekday nil ; Show agenda from today.
org-agenda-files '("~/Dropbox/life.org") ; A list of agenda files. org-agenda-files '("~/Dropbox/life.org") ; A list of agenda files.
org-agenda-default-appointment-duration 120 ; 2 hours appointments. org-agenda-default-appointment-duration 120 ; 2 hours appointments.
@ -332,6 +341,7 @@ PACKAGE is installed and the current version is deleted."
(global-set-key (kbd "C-x k") 'kill-this-buffer) (global-set-key (kbd "C-x k") 'kill-this-buffer)
(global-set-key (kbd "C-x C-r") 'recentf-ido-find-file) (global-set-key (kbd "C-x C-r") 'recentf-ido-find-file)
(global-set-key (kbd "C-c l") 'cycle-languages)
(global-set-key (kbd "C-c j") 'remove-whitespace-inbetween) (global-set-key (kbd "C-c j") 'remove-whitespace-inbetween)
(global-set-key (kbd "C-x t") 'switch-to-shell) (global-set-key (kbd "C-x t") 'switch-to-shell)
(global-set-key (kbd "C-c d") 'duplicate-thing) (global-set-key (kbd "C-c d") 'duplicate-thing)

View File

@ -489,6 +489,26 @@
(ac-flyspell-workaround) (ac-flyspell-workaround)
#+END_SRC #+END_SRC
To cycle through dictionary's we can define a variable containing a
cyclic list of installed language packs.
#+BEGIN_SRC emacs-lisp :tangle yes
(defvar ispell-languages '#1=("english" "norsk" . #1#))
#+END_SRC
Now we only need a small function to change set the language and shift
the list.
#+BEGIN_SRC emacs-lisp :tangle yes
(defun cycle-languages ()
"Changes the ispell-dictionary to whatever is the next (or cdr) in the
LANGUAGES (cyclic) list."
(interactive)
(ispell-change-dictionary
(car (setq ispell-languages (cdr ispell-languages)))))
#+END_SRC
** Org ** Org
I use =org-agenda= for appointments and such. I use =org-agenda= for appointments and such.
@ -622,6 +642,7 @@
Bind the functions defined [[sec:defuns][above]]. Bind the functions defined [[sec:defuns][above]].
#+BEGIN_SRC emacs-lisp :tangle yes #+BEGIN_SRC emacs-lisp :tangle yes
(global-set-key (kbd "C-c l") 'cycle-languages)
(global-set-key (kbd "C-c j") 'remove-whitespace-inbetween) (global-set-key (kbd "C-c j") 'remove-whitespace-inbetween)
(global-set-key (kbd "C-x t") 'switch-to-shell) (global-set-key (kbd "C-x t") 'switch-to-shell)
(global-set-key (kbd "C-c d") 'duplicate-thing) (global-set-key (kbd "C-c d") 'duplicate-thing)