[emacs][Tuareg-mode] Symbol's function definition is void: dolist - emacs

I tried to install Tuareg-mode for Ocaml as advice on the Inria website.
Any time I try to launch it I have this error :
Symbol's function definition is void: dolist
With edebug-defun
Debugger entered--Lisp error: (void-function dolist)
apply(debug error (void-function dolist))
edebug(error (void-function dolist))
(dolist (buf (buffer-list)) (save-current-buffer (set-buffer buf) (if (derived-mode-p (quote tuareg-mode)) (progn (abbrev-mode (if val 1 -1))))))
(lambda (var val) (set-default var val) (dolist (buf (buffer-list)) (save-current-buffer (set-buffer buf) (if (derived-mode-p (quote tuareg-mode)) (progn (abbrev-mode (if val 1 -$
custom-initialize-reset(tuareg-use-abbrev-mode t)
custom-declare-variable(tuareg-use-abbrev-mode t "*Non-nil means electrically indent lines starting with leading keywords.\nLeading keywords are such as `end', `done', `else' etc$
eval-buffer(#<buffer *load*> nil "/nfs/ring/users/2013/phibonacci/.emacs.d/tuareg-mode/tuareg.el" nil t) ; Reading at buffer position 13589
load-with-code-conversion("/nfs/ring/users/2013/phibonacci/.emacs.d/tuareg-mode/tuareg.el" "/nfs/ring/users/2013/phibonacci/.emacs.d/tuareg-mode/tuareg.el" nil t)
command-execute(tuareg-mode record)
execute-extended-command(nil "tuareg-mode")
call-interactively(execute-extended-command nil nil)
recursive-edit()
edebug--recursive-edit(before)
edebug--display(nil 0 before)
edebug-debugger(0 before nil)
edebug-before(0)
(edebug-after (edebug-before 0) 1 (autoload (quote tuareg-mode) "tuareg" "Major mode for editing Caml code" t))
(lambda nil (edebug-after (edebug-before 0) 1 (autoload (quote tuareg-mode) "tuareg" "Major mode for editing Caml code" t)))()
edebug-enter(edebug-anon0 nil (lambda nil (edebug-after (edebug-before 0) 1 (autoload (quote tuareg-mode) "tuareg" "Major mode for editing Caml code" t))))
edebug-enter(edebug-anon0 nil (lambda nil (edebug-after (edebug-before 0) 1 (autoload (quote tuareg-mode) "tuareg" "Major mode for editing Caml code" t))))
eval((edebug-enter (quote edebug-anon0) nil (function (lambda nil (edebug-after (edebug-before 0) 1 (autoload (quote tuareg-mode) "tuareg" "Major mode for editing Caml code" t)))$
eval-expression((edebug-enter (quote edebug-anon0) nil (function (lambda nil (edebug-after (edebug-before 0) 1 (autoload (quote tuareg-mode) "tuareg" "Major mode for editing Caml$
edebug-defun()
call-interactively(edebug-defun record nil)
command-execute(edebug-defun record)
execute-extended-command(nil "edebug-defun")
call-interactively(execute-extended-command nil nil)
"/nfs/ring/users/2013/phibonacci" is my home directory.
I followed this : http://www.emacswiki.org/emacs/TuaregMode (only replaced ~/.elisp/tuareg-mode by my own path ~/.emacs.d/tuareg-mode)
emacs 24.3.1 (2013) /
tuareg 2.0.6 (2012)

dolist is from the common lisp Emacs library. If tuareg uses dolist without an (eval-when-compile ...(require 'cl)...) it's a bug. As a workaround you can do (require 'cl) in your .emacs. This is not recommended by the purist Emacs community, but it's fairly common.

IIRC dolist was added to standard Elisp sometimes around Emacs-21, so there's something really wrong with your setup.

Related

Emacs -- modify `dired-mark` to prevent moving cursor to an empty line at eob

I have a custom function that gets dired marked file names (i.e., the names of every marked file) if more than one has been marked, or if only one, it gets the file name at point. A problem occurs whenever the cursor is in no-man's-land because dired-mark (or me, because I'm the pilot) got overzealous on repetition and moves the cursor to a blank line at the end of the buffer where there is no file. In that situation, the error is as follows:
Debugger entered--Lisp error: (error "No file on this line")
signal(error ("No file on this line"))
error("No file on this line")
dired-get-file-for-visit()
(file-directory-p (dired-get-file-for-visit))
(if (file-directory-p (dired-get-file-for-visit)) nil (let ((lawlist-filename (if (or (re-search-backward "^*" nil t) (re-search-forward "^*" nil t)) (dired-get-marked-files) (dired-get-file-for-visit)))) (wl-draft-mailto) (attach-multiple-files lawlist-filename)))
(lambda nil (interactive) (if (file-directory-p (dired-get-file-for-visit)) nil (let ((lawlist-filename (if (or (re-search-backward "^*" nil t) (re-search-forward "^*" nil t)) (dired-get-marked-files) (dired-get-file-for-visit)))) (wl-draft-mailto) (attach-multiple-files lawlist-filename))))()
funcall-interactively((lambda nil (interactive) (if (file-directory-p (dired-get-file-for-visit)) nil (let ((lawlist-filename (if (or (re-search-backward "^*" nil t) (re-search-forward "^*" nil t)) (dired-get-marked-files) (dired-get-file-for-visit)))) (wl-draft-mailto) (attach-multiple-files lawlist-filename)))))
call-interactively((lambda nil (interactive) (if (file-directory-p (dired-get-file-for-visit)) nil (let ((lawlist-filename (if (or (re-search-backward "^*" nil t) (re-search-forward "^*" nil t)) (dired-get-marked-files) (dired-get-file-for-visit)))) (wl-draft-mailto) (attach-multiple-files lawlist-filename)))) nil nil)
command-execute((lambda nil (interactive) (if (file-directory-p (dired-get-file-for-visit)) nil (let ((lawlist-filename (if (or (re-search-backward "^*" nil t) (re-search-forward "^*" nil t)) (dired-get-marked-files) (dired-get-file-for-visit)))) (wl-draft-mailto) (attach-multiple-files lawlist-filename)))))
I like the ability to hold the dired-mark key down for repetition, but I would like it to stop at the last line with a file in the dired-mode buffer. Any ideas on how to accomplish that goal would be greatly appreciated. Moving past that point, performing a test, and then returning to the previous point seems to not be a very efficient means of handling it. It might be better to terminate the dired buffer at the end of the last line with a file, so that there is no blank line -- i.e., if there is no blank line at the end of the dired-mode buffer, then dired-mark can't go there (so that would be good?).
EDIT:  The debugger message has been updated with a complete backtrace. The following is the custom function that may be, as #Drew suggests, the root cause of the error message that I am receiving:
;; E-mail attachments using Wanderlust.
(define-key dired-mode-map (kbd "C-c e") (lambda () (interactive)
;; if hovering over a directory, then do nothing
(unless (file-directory-p (dired-get-file-for-visit))
(let ((lawlist-filename
(if (or (re-search-backward "^*" nil t)
(re-search-forward "^*" nil t))
(dired-get-marked-files)
(dired-get-file-for-visit))))
(wl-draft-mailto)
(attach-multiple-files lawlist-filename)))))
(defun attach-multiple-files (&optional lawlist-filename)
"Either (dired-get-marked-files) or (dired-get-file-for-visit) when exiting recursive edit."
(interactive)
(let* (
new-dir
(beg (point))
(dir "/Users/HOME/.0.data"))
(goto-char (point-min))
(when (and (re-search-forward "username#hostname.com" nil t) (not (re-search-forward "username#hostname.com\n" nil t)))
(goto-char (point-max))
(newline 2))
(catch 'done
(while t
(goto-char (point-max))
(let* (
(multi-attach-variable t)
(next-file
(if lawlist-filename
lawlist-filename
(dired-read-file-name
(if new-dir
new-dir
dir)))) )
(setq new-dir
(cond
((and next-file (stringp next-file))
(file-name-directory next-file))
((and next-file (listp next-file))
(file-name-directory (car next-file)))))
(cond
((stringp next-file)
(mime-edit-insert-file next-file t))
((listp next-file)
(mapcar (lambda (x) (mime-edit-insert-file x t)) next-file)))
(setq lawlist-filename nil)
(if (not (lawlist-y-or-n-p "Attach another? "))
(progn
(goto-char beg)
(throw 'done nil))))))))
Try defadvice on dired-mark to avoid landing in no-man's-land:
(defadvice dired-mark (after stop-at-last-file activate)
(when (eobp)
(previous-line 1)))
The "move forward after marking" functionality is baked into dired-mark (actually, if you want to get into the guts of it, into dired-repeat-over-lines), so this advice checks if it put you on that blank line and moves you back if so. Your last paragraph suggests you might not be super-keen on this option, but it strikes me as less troublesome than altering the dired internals.
Previous Answer (October 17, 2014):  The following 3 lines of code will halt the function if the cursor is not on a file or directory and if nothing has been marked:
(when (null (dired-get-marked-files))
(let ((debug-on-quit nil))
(signal 'quit `("You are not on a line containing a valid file or directory."))))
Revised Answer (January 20, 2015):  The function dired-insert-directory may be modified to delete trailing new lines and/or whitespace at the end of the buffer as follows:
(goto-char (point-max))
(let ((trailing-whitespace+newlines (abs (skip-chars-backward "\s\r\n\t"))))
(when (> trailing-whitespace+newlines 0)
(delete-char trailing-whitespace+newlines)))

dbus error in emacs

I am trying to use notify.el on OS X, but every time get next error:
Symbol's value as variable is void: dbus-message-type-method-call
emacs --debug-init gives next output:
Debugger entered--Lisp error: (void-variable dbus-message-type-method-call)
dbus-call-method(:session "org.freedesktop.Notifications" "/org/freedesktop/DBus" "org.freedesktop.DBus.Peer" "Ping")
byte-code("\305^H!\203^S^#\306 \n^K\f\307\310^H&^G\202^Z^#\306 \n^K\f\307%?\207" [timeout bus service dbus-path-dbus dbus-interface-peer natnump dbus-call-method "Ping" :timeout] 8)
dbus-ping(:session "org.freedesktop.Notifications")
(and (require (quote dbus) nil t) (dbus-ping :session "org.freedesktop.Notifications"))
(cond ((executable-find "growlnotify") (quote notify-via-growl)) ((and (require (quote dbus) nil t) (dbus-ping :session "org.freedesktop.Notifications")) (defvar notify-id 0 "Current D-Bus notification$
(setq notify-method (cond ((executable-find "growlnotify") (quote notify-via-growl)) ((and (require (quote dbus) nil t) (dbus-ping :session "org.freedesktop.Notifications")) (defvar notify-id 0 "Curren$
(cond ((null notify-method) (setq notify-method (cond ((executable-find "growlnotify") (quote notify-via-growl)) ((and (require (quote dbus) nil t) (dbus-ping :session "org.freedesktop.Notifications"))$
eval-buffer(#<buffer *load*-569235> nil "/Users/araeris/.emacs.d/packages/notify/notify.el" nil t) ; Reading at buffer position 3614
load-with-code-conversion("/Users/araeris/.emacs.d/packages/notify/notify.el" "/Users/araeris/.emacs.d/packages/notify/notify.el" nil t)
require(notify)
(if (fboundp name) nil (add-to-list (quote load-path) (concat (file-name-directory (or load-file-name (buffer-file-name))) "packages/" (symbol-name name))) (require name))
(progn (if (fboundp name) nil (add-to-list (quote load-path) (concat (file-name-directory (or load-file-name (buffer-file-name))) "packages/" (symbol-name name))) (require name)))
(while (consp --cl-var--) (setq name (car --cl-var--)) (progn (if (fboundp name) nil (add-to-list (quote load-path) (concat (file-name-directory (or load-file-name (buffer-file-name))) "packages/" (sym$
(let* ((--cl-var-- packages) (name nil)) (while (consp --cl-var--) (setq name (car --cl-var--)) (progn (if (fboundp name) nil (add-to-list (quote load-path) (concat (file-name-directory (or load-file-n$
(progn (let* ((--cl-var-- packages) (name nil)) (while (consp --cl-var--) (setq name (car --cl-var--)) (progn (if (fboundp name) nil (add-to-list (quote load-path) (concat (file-name-directory ...) "pa$
eval-buffer(#<buffer *load*> nil "/Users/araeris/.emacs.d/init.el" nil t) ; Reading at buffer position 1796
load-with-code-conversion("/Users/araeris/.emacs.d/init.el" "/Users/araeris/.emacs.d/init.el" t t)
load("/Users/araeris/.emacs.d/init" t t)
#[0 "^H\205\262^# \306=\203^Q^#\307^H\310Q\202;^# \311=\204^^^#\307^H\312Q\202;^#\313\307\314\315#\203*^#\316\202;^#\313\307\314\317#\203:^#\320\nB^R\321\202;^#\316\322^S\323^A\322\211#\210^K\322=\$
command-line()
normal-top-level()
Does anyone knows how to handle it?
P. S. I already installed dbus via homebrew.
You'll need to build Emacs with DBus support to actually use DBus. On OS X, that's rather unusual, and I can't see what you'd want to use DBus support in Emacs for, given that nothing else uses DBus on OS X.
If you're just after notifications, though, you don't need DBus. In fact, DBus won't give you notifications on OS X.
For notifications on OS X with notify.el, you need Growl. Namely, you must purchase Growl in the AppStore, or build it yourself, and additionally install Growlnotifier from http://growl.info/downloads.

How to throw a value when exiting recursive edit (without using setq)

Is it possible to throw a value when exiting recursive edit without using setq?
The functions below work correctly with setq, however, my goal is to eliminate unnecessary global variables (if possible) -- especially file names -- and use let bound variables instead. In the context of throwing a value when exiting recursive edit, however, I have been unable to devise a method that does not use a global variable for the file name.
In this example, I am using lawlist-save-as in conjunction with dired-read-file-name to enter dired-mode and select a file name or a path. Pressing the enter key on a file name selects a file. Pressing the enter key on a directory name or the two (2) dots moves up one directory. Pressing the enter key on the line with just one (1) dot, means select only the path in the current directory. The value of the file name or path is passed back to the function lawlist-save-as through the last line of dired-read-file-name.
[Although not necessary for this example (but just in case anyone is curious), getting marked files with (dired-get-marked-files) is used for a different situation, such as attaching multiple files to an e-mail using Wanderlust -- in which case, I use the condition ((listp lawlist-filename) (throw 'exit nil)). And, of course, opening a file is self-explanatory -- used for a situation when dired-mode is entered regularly and then just pressing the return key on a file to be opened.]
(require 'dired)
(defvar lawlist-filename nil)
(defvar save-as-buffer-filename nil)
(defvar save-as-variable nil)
(defvar dired-buffer-name nil)
(defun dired-read-file-name (&optional directory)
(let ((working-buffer (buffer-name)))
(if directory
(dired directory)
(dired nil))
(let ((dired-buffer-name (buffer-name)))
(if save-as-buffer-filename
(progn
(goto-char (point-min))
(re-search-forward (file-name-nondirectory save-as-buffer-filename) nil t)))
(recursive-edit)
(kill-buffer dired-buffer-name)
(switch-to-buffer working-buffer)
lawlist-filename)))
;; select file or directory.
(define-key dired-mode-map (kbd "<return>") (lambda () (interactive)
(setq lawlist-filename
(if (or (re-search-backward "^*" nil t)
(re-search-forward "^*" nil t))
(dired-get-marked-files)
(dired-get-file-for-visit)))
(cond
((listp lawlist-filename)
(throw 'exit nil))
;; open file
((and (not (file-directory-p lawlist-filename))
(file-exists-p lawlist-filename)
(not (equal lawlist-filename (concat (file-name-directory lawlist-filename) ".")))
(not save-as-variable))
(find-file lawlist-filename))
;; save-as
((and (not (file-directory-p lawlist-filename))
(file-exists-p lawlist-filename)
(not (equal lawlist-filename (concat (file-name-directory lawlist-filename) "."))))
(throw 'exit nil))
;; go up one directory
((and (file-directory-p lawlist-filename)
(not (equal lawlist-filename (concat (file-name-directory lawlist-filename) "."))))
(setq dired-buffer-name (buffer-name))
(dired-find-file)
(goto-char (point-min))
(re-search-forward " \\.\\.$" nil t)
(kill-buffer dired-buffer-name)
(setq dired-buffer-name (buffer-name)))
;; only use current path for save-as situation.
((and (equal lawlist-filename (concat (file-name-directory lawlist-filename) "."))
save-as-variable)
(setq lawlist-filename (expand-file-name default-directory))
(throw 'exit nil)) )))
(defun lawlist-save-as ()
(interactive)
(setq save-as-variable t)
(if (buffer-file-name)
(setq save-as-buffer-filename (buffer-file-name)))
(let ((proposed-filename (dired-read-file-name)))
(when proposed-filename ;; needed if aborting recursive-edit
(setq save-as-variable nil)
(let ((save-as-filename (read-string "Save-As: "
(concat proposed-filename (when (file-directory-p proposed-filename) (buffer-name))))))
(setq save-as-buffer-filename nil)
(when (and save-as-filename (file-exists-p save-as-filename))
(or (y-or-n-p (format "File `%s' exists; overwrite? " save-as-filename))
(error "Canceled")))
(set-visited-file-name save-as-filename)
(set-buffer-modified-p t)
(and (buffer-file-name)
(file-writable-p buffer-file-name)
(setq buffer-read-only nil))
(save-buffer)))))
recursive-edit is just a function that runs a command loop. All stuff that is valid for lisp applies.
So if you encapsulate recursive-edit into a let which locally binds some variable, say test, and if you setq this variable during the recursive edit session this variable is just set locally in the scope of the let.
Example:
Run the following with C-x C-e:
(let (test)
(recursive-edit)
(message "test=%S" test))
You will be in the command loop of the recursive edit. Then set test via M-: (setq test "That is my test.").
Afterwards press M-C-c to exit the recursive edit session.
The message test=\"That is my test.\" is be printed out but the symbol test is still unbound.

How can I execute a lisp function while pressing prefix key C-h and then let Emacs continue the normal processing of C-h?

I want to execute a lisp function while pressing prefix key C-h and then let Emacs continue the normal processing of C-h.
How can I do it?
Thank you!
Evaluating
(key-binding [(control h)])
I found out the command bound is help-command. You can use an "around" defadvice to run your code. See manual.
(defvar smart-ime--state 'normal)
(defvar smart-ime--debug nil)
(defvar smart-ime--ena-prefix-override-keymap nil)
(defvar smart-ime--prefix-override-keymap (make-sparse-keymap))
(defvar smart-ime--keymaps-initialized nil)
(defvar smart-ime--keymap-alist
`(
(smart-ime--ena-prefix-override-keymap . ,smart-ime--prefix-override-keymap)
)
)
(defun smart-ime--init-keymaps ()
(define-key smart-ime--prefix-override-keymap [(control x)] 'smart-ime--prefix-override-handler)
(define-key smart-ime--prefix-override-keymap [(control c)] 'smart-ime--prefix-override-handler)
(define-key smart-ime--prefix-override-keymap [(control h)] 'smart-ime--prefix-override-handler)
)
(defun smart-ime--prefix-override-handler (arg)
(interactive "P")
(smart-ime--prefix-override-replay arg))
;; the most important part
(defun smart-ime--prefix-override-replay (arg)
(let* ((keys (this-command-keys))
(i (length keys))
(key (aref keys (1- i))))
(ime-save-and-set-status 0)
(add-hook 'post-command-hook 'smart-ime--post-command-handler)
(setq smart-ime--state 'prefix)
(setq smart-ime--ena-prefix-override-keymap nil)
;; Don't record this command
(setq this-command last-command)
;; Restore the prefix arg
(setq prefix-arg arg)
(reset-this-command-lengths)
;; Push the key back on the event queue
(setq unread-command-events (cons key unread-command-events))))
(defun smart-ime--post-command-handler-1 ()
(cond ((eq smart-ime--state 'prefix)
(setq smart-ime--state 'sequence))
((eq smart-ime--state 'sequence)
(ime-restore-status)
(setq smart-ime--ena-prefix-override-keymap t)
(setq smart-ime--state 'normal)
(remove-hook 'post-command-hook 'smart-ime--post-command-handler)))
(t
(error "error state")))
(defun smart-ime--post-command-handler ()
(when smart-ime-mode
(condition-case nil
(smart-ime--post-command-handler-1)
(error nil))))
(define-minor-mode smart-ime-mode
"Toggle Smart IME mode."
:init-value nil
:lighter " SmartIME"
:global t
(unless smart-ime--keymaps-initialized
(smart-ime--init-keymaps)
(setq smart-ime--keymaps-initialized t))
(unless smart-ime-mode
(remove-hook 'post-command-hook 'smart-ime--post-command-handler))
(if (not smart-ime-mode)
(setq emulation-mode-map-alists (delq 'smart-ime--keymap-alist emulation-mode-map-alists))
(add-to-ordered-list 'emulation-mode-map-alists 'smart-ime--keymap-alist 400)
(setq smart-ime--ena-prefix-override-keymap t))
)
;;; Announce
(provide 'smart-ime)

Can't seem to get rid of Ctrl-x Ctrl-z Key Binding in Emacs for minimizing window ('suspend-frame)

I keep trying to get rid of this keybinding but setting it to nil or 'undo which would be fine with no luck. I am not sure why it even gets set to C-x C-z in the first place. I wouldn't even mind permanently removing the suspend-frame command if that would provide a solution.
Here is my .emacs file if it helps:
;;Style files and multi-file documents
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(setq inhibit-splash-screen t)
;; Use PDF mode by default
(setq-default TeX-PDF-mode t)
(setq TeX-save-query nil)
(global-auto-revert-mode t)
(global-set-key "\C-x C-z" nil)
(global-set-key "\C-z" nil)
;;Abbreviation mode and settings
(add-hook 'text-mode-hook (lambda () (abbrev-mode 1)))
(setq save-abbrevs t)
(quietly-read-abbrev-file)
;;Reftex and then turn on for Auctex
(require 'reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
;;Enable preview latex
(load "preview-latex.el" nil t t)
;; For line numbers loading
(require 'linum)
(setq linum-format "%d ")
(global-linum-mode 1)
;; ===== Set the highlight current line minor mode =====
(global-hl-line-mode 1)
;; ===== Set standard indent to 2 rather that 4 ====
;;(setq standard-indent 2)
;; ========== Enable Line and Column Numbering ==========
;; Show line-number in the mode line
(line-number-mode 1)
;; Show column-number in the mode line
(column-number-mode 1)
;; ========== Force emacs to use tabs ==================
;; Turn on tabs
;;(setq indent-tabs-mode t)
;;(setq-default indent-tabs-mode t)
;; Bind the TAB key
;;(global-set-key (kbd "TAB") 'self-insert-command)
;; Set the tab width
;;(setq default-tab-width 4)
;;(setq tab-width 4)
;;(setq c-basic-indent 4)
(setq outline-minor-mode 1)
; Outline-minor-mode key map
(define-prefix-command 'cm-map nil "Outline-")
; HIDE
(define-key cm-map "q" 'hide-sublevels) ; Hide everything but the top-level headings
(define-key cm-map "t" 'hide-body) ; Hide everything but headings (all body lines)
(define-key cm-map "o" 'hide-other) ; Hide other branches
(define-key cm-map "c" 'hide-entry) ; Hide this entry's body
(define-key cm-map "l" 'hide-leaves) ; Hide body lines in this entry and sub-entries
(define-key cm-map "d" 'hide-subtree) ; Hide everything in this entry and sub-entries
; SHOW
(define-key cm-map "a" 'show-all) ; Show (expand) everything
(define-key cm-map "e" 'show-entry) ; Show this heading's body
(define-key cm-map "i" 'show-children) ; Show this heading's immediate child sub-headings
(define-key cm-map "k" 'show-branches) ; Show all sub-headings under this heading
(define-key cm-map "s" 'show-subtree) ; Show (expand) everything in this heading & below
; MOVE
(define-key cm-map "u" 'outline-up-heading) ; Up
(define-key cm-map "n" 'outline-next-visible-heading) ; Next
(define-key cm-map "p" 'outline-previous-visible-heading) ; Previous
(define-key cm-map "f" 'outline-forward-same-level) ; Forward - same level
(define-key cm-map "b" 'outline-backward-same-level) ; Backward - same level
(global-set-key "\M-o" cm-map)
;;Display recent files
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-items 50)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
;; Allows hiding and folding
(defun turn-on-outline-minor-mode ()
(outline-minor-mode 1))
;;Flymake mode to check syntax on the fly
;;(require 'flymake)
;;(add-hook 'find-file-hook 'flymake-find-file-hook)
;;(defun flymake-get-tex-args (file-name)
;; (list "pdflatex" (list "-file-line-error" "-draftmode" "-interaction=nonstopmode" file-name)))
;;Fly spell mode
(dolist (hook '(text-mode-hook))
(add-hook hook (lambda () (flyspell-mode 1))))
(require 'tabbar)
; turn on the tabbar
(tabbar-mode t)
; define all tabs to be one of 3 possible groups: “Emacs Buffer”, “Dired”,
;“User Buffer”.
(defun tabbar-buffer-groups ()
"Return the list of group names the current buffer belongs to.
This function is a custom function for tabbar-mode's tabbar-buffer-groups.
This function group all buffers into 3 groups:
Those Dired, those user buffer, and those emacs buffer.
Emacs buffer are those starting with “*”."
(list
(cond
((string-equal "*" (substring (buffer-name) 0 1))
"Emacs Buffer"
)
((eq major-mode 'dired-mode)
"Dired"
)
(t
"User Buffer"
)
)))
(setq tabbar-buffer-groups-function 'tabbar-buffer-groups)
(define-key global-map [(super j)] 'tabbar-backward)
(define-key global-map [(super k)] 'tabbar-forward)
(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.
'(LaTeX-indent-level 4)
'(LaTeX-item-indent -2)
'(TeX-PDF-mode t)
'(TeX-auto-save t)
'(TeX-brace-indent-level 4)
'(TeX-command-list (quote (("doall" "%`%l%(mode)%' %t && bibtex %s && %`%l%(mode)%' %t && %`%l%(mode)%' %t && %V" TeX-run-TeX nil t :help "Run LaTeX BibTeX LaTeX LaTeX View") ("ebibno" "%`%l%(mode)%' %t && %`%l%(mode)%' %t && %`%l%(mode)%' %t && %V" TeX-run-TeX nil t :help "Run LaTeX View") ("TeX" "%(PDF)%(tex) %`%S%(PDFout)%(mode)%' %t" TeX-run-TeX nil (plain-tex-mode texinfo-mode ams-tex-mode) :help "Run plain TeX") ("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX") ("Makeinfo" "makeinfo %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with Info output") ("Makeinfo HTML" "makeinfo --html %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with HTML output") ("AmSTeX" "%(PDF)amstex %`%S%(PDFout)%(mode)%' %t" TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX") ("ConTeXt" "texexec --once --texutil %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt once") ("ConTeXt Full" "texexec %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt until completion") ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX") ("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer") ("Print" "%p" TeX-run-command t t :help "Print the file") ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible TeX-queue-command) ("File" "%(o?)dvips %d -o %f " TeX-run-command t t :help "Generate PostScript file") ("Index" "makeindex %s" TeX-run-command nil t :help "Create index file") ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for correctness") ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help "Spell-check the document") ("Clean" "TeX-clean" TeX-run-function nil t :help "Delete generated intermediate files") ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help "Delete generated intermediate and output files") ("Other" "" TeX-run-command t t :help "Run an arbitrary command"))))
'(TeX-debug-warnings t)
'(TeX-master nil)
'(TeX-source-correlate-method (quote synctex))
'(TeX-source-correlate-mode t)
'(TeX-source-correlate-start-server t)
'(TeX-view-program-list (quote (("Okular" "okular --unique %o#src:%n%b"))))
'(TeX-view-program-selection (quote (((output-dvi style-pstricks) "dvips and gv") (output-dvi "xdvi") (output-pdf "Okular") (output-html "xdg-open"))))
'(column-number-mode t)
'(cua-enable-cua-keys t)
'(cua-mode t nil (cua-base)))
(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 "white" :foreground "black" :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")))))
;;Switch to last recent buffer used with F11 or ShiftF11
(when (require 'bubble-buffer nil t)
(global-set-key [f11] 'bubble-buffer-next)
(global-set-key [(shift f11)] 'bubble-buffer-previous))
(setq bubble-buffer-omit-regexp "\\(^ .+$\\|\\*Messages\\*\\|*compilation\\*\\|\\*.+output\\*$\\|\\*TeX Help\\*$\\|\\*vc-diff\\*\\|\\*Occur\\*\\|\\*grep\\*\\|\\*cvs-diff\\*\\)")
(global-set-key "\M-n" (lambda () (interactive) (scroll-up 6)) )
(global-set-key "\M-p" (lambda () (interactive) (scroll-down 6)) )
(defun sfp-page-down (&optional arg)
(interactive "^P")
(setq this-command 'next-line)
(next-line
(- (window-text-height)
next-screen-context-lines)))
(put 'sfp-page-down 'isearch-scroll t)
(put 'sfp-page-down 'CUA 'move)
(defun sfp-page-up (&optional arg)
(interactive "^P")
(setq this-command 'previous-line)
(previous-line
(- (window-text-height)
next-screen-context-lines)))
(put 'sfp-page-up 'isearch-scroll t)
(put 'sfp-page-up 'CUA 'move)
(set-face-attribute 'default nil :height 100)
(setq cua-mode t)
(require 'latex)
(when (require 'browse-kill-ring nil 'noerror)
(browse-kill-ring-default-keybindings))
(global-set-key "\C-cy" '(lambda ()
(interactive)
(popup-menu 'yank-menu)))
(setq x-select-enable-clipboard t)
(define-key LaTeX-mode-map (read-kbd-macro "C-c C-a")
(lambda ()
(interactive)
(TeX-save-document (TeX-master-file))
(TeX-command "Doall" 'TeX-master-file -1)))
;;(autoload 'whizzytex-mode "whizzytex"
;;"WhizzyTeX, a minor-mode WYSIWYG environment for LaTeX" t)
;;Set up extra key-bindings for reftex
;;(setq reftex-extra-bindings t)
(defun my-latex-setup ()
(defun latex-word-count ()
(interactive)
(let* ((this-file (buffer-file-name))
(word-count
(with-output-to-string
(with-current-buffer standard-output
(call-process "texcount" nil t nil "-inc" "-brief" this-file)))))
(string-match "\n$" word-count)
(message (replace-match "" nil nil word-count))))
(define-key LaTeX-mode-map "\C-cw" 'latex-word-count)
(define-key LaTeX-mode-map "\C-xw" 'latex-word-count))
(add-hook 'LaTeX-mode-hook 'my-latex-setup t)
(global-set-key "\C-x C-z" 'undo)
(add-hook 'text-mode-hook (lambda ()
(local-set-key (kbd "C-c C-.")
(lambda () (interactive) (search-forward "." nil t)))))
(add-hook 'text-mode-hook (lambda ()
(local-set-key (kbd "C-c C-,")
(lambda () (interactive) (search-backward "." nil t)))))
(require 'ido)
(ido-mode t)
(fset 'yes-or-no-p 'y-or-n-p)
;(global-set-key (kbd "C-?") 'hippie-expand) not working
;(setq hippie-expand-try-functions-list '(try-expand-dabbrev try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-complete-file-name-partially try-complete-file-name try-expand-all-abbrevs try-expand-list try-expand-line try-complete-lisp-symbol-partially try-complete-lisp-symbol))
;;Save place in files between sessions
(require 'saveplace)
(setq-default save-place t)
;;Added windows.el configuration
(require 'windows)
;; -- load the saved windows automatically on boot
(add-hook 'window-setup-hook 'resume-windows)
;; -- use this command to quit and save your setup
(define-key ctl-x-map "C" 'see-you-again)
;; -- set up window saving !! Place at end of .emacs file
(win:startup-with-window)
Your string representation of C-x C-z needs adjusting. Try either of the following:
(global-set-key "\C-x\C-z" nil)
(global-set-key (kbd "C-x C-z") nil)
Or you can disable the suspend-frame command:
(put 'suspend-frame 'disabled t)
Try this:
(global-unset-key "\C-z")
(global-unset-key "\C-x\C-z")