stardiviner
12/4/2013 - 3:16 AM

Tasks.org

When I start Emacs, then get this error in startup process:

#+NAME: error ouput
#+BEGIN_EXAMPLE
Debugger entered--Lisp error: (wrong-number-of-arguments (lambda (beg end length) "If `auto-capitalize' mode is on, then capitalize the previous word.
The previous word is capitalized (or upcased) if it is a member of the
`auto-capitalize-words' list; or if it begins a paragraph or sentence.

Capitalization occurs only if the current command was invoked via a
self-inserting non-word character (e.g. Whitespace or punctuation); but
if the `auto-capitalize-yank' option is set, then the first word of
yanked sentences will be capitalized as well.

Capitalization can be disabled in specific contexts via the
`auto-capitalize-predicate' variable.

This should be installed as an `after-change-function'." (If (and auto-capitalize (or (null auto-capitalize-predicate) (funcall auto-capitalize-predicate))) (cond ((or (and (or (eq this-command (quote self-insert-command)) (let ((key (this-command-keys))) (and (if (and (vectorp key) (> (length key) 0) (fboundp (quote misc-user-event-p)) (misc-user-event-p (aref key 0))) nil (eq (lookup-key global-map key t) (quote self-insert-command))) (= length 0) (= (- end beg) 1)))) (let ((self-insert-char (cond (nil (event-to-character last-command-event nil nil t)) (t last-command-event)))) (not (equal (char-syntax self-insert-char) 119)))) (eq this-command (quote newline)) (eq this-command (quote newline-and-indent))) (if (and (> beg (point-min)) (equal (char-syntax (char-after (1- beg))) 119)) (save-excursion (forward-word -1) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (let* ((word-start (point)) (text-start (progn (while (or (minusp (skip-chars-backward "\"")) (minusp (skip-syntax-backward "\"("))) t) (point))) lowercase-word) (cond ((and auto-capitalize-words (let ((case-fold-search nil)) (goto-char word-start) (looking-at (concat "\\(" (mapconcat (quote downcase) auto-capitalize-words "\\|") "\\)\\>")))) (if (not (member (setq lowercase-word (buffer-substring (match-beginning 1) (match-end 1))) auto-capitalize-words)) (progn (undo-boundary) (replace-match (find lowercase-word auto-capitalize-words :key (quote downcase) :test (quote string-equal)) t t)))) ((and (or (equal text-start (point-min)) (progn (goto-char text-start) (and (= (current-column) left-margin) (zerop (forward-line -1)) (looking-at paragraph-separate))) (progn (goto-char text-start) (and (= (current-column) left-margin) (re-search-backward paragraph-start nil t) (= (match-end 0) text-start) (= (current-column) left-margin))) (progn (goto-char text-start) (save-restriction (narrow-to-region (point-min) word-start) (and (re-search-backward (auto-capitalize-sentence-end) nil t) (= (match-end 0) text-start) (let ((previous-char (char-after (1- text-start)))) (or (equal previous-char 10) (equal (char-syntax previous-char) 32))) (let ((case-fold-search nil) (abbrev-regexp (if nil "\\<\\([A-Z�-��-�]?[a-z�-��-�]+\\.\\)+\\=" "\\<\\([[:upper:]]?[[:lower:]]+\\.\\)+\\="))) (goto-char (1+ (match-beginning 0))) (or (not (re-search-backward abbrev-regexp nil t)) (not (member (buffer-substring (match-beginning 0) (match-end 0)) auto-capitalize-words)))))))) (let ((case-fold-search nil)) (goto-char word-start) (looking-at (if nil "[a-z�-��-�]+" "[[:lower:]]+"))) (or (eq auto-capitalize t) (prog1 (y-or-n-p (format "Capitalize \"%s\"? " (buffer-substring (match-beginning 0) (match-end 0)))) (message "")))) (undo-boundary) (goto-char word-start) (capitalize-word 1))))) (set-match-data save-match-data-internal (quote evaporate))))))) ((and auto-capitalize-yank (or (eq this-command (quote yank)) (and (= length 0) (eq this-command (quote t))))) (save-excursion (goto-char beg) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (while (re-search-forward "\\Sw" end t) (let* ((this-command (quote self-insert-command)) (non-word-char (char-after (match-beginning 0))) (last-command-event (cond (nil (character-to-event non-word-char)) (t non-word-char)))) (auto-capitalize (match-beginning 0) (match-end 0) 0)))) (set-match-data save-match-data-internal (quote evaporate))))))))) 1)
  auto-capitalize(1)
  #[2569 "										r\306	!\210\307 \310\311\312\313\314\315\316\n#\317\"\320\321%D\322\311\312\323\324\315\316!\325\"\326\327%\310EDC\217\330!\203U
#+END_EXAMPLE

I set auto-capitalize with this:

#+NAME: auto-capitalize init
#+BEGIN_SRC emacs-lisp
(require 'auto-capitalize)

(autoload 'auto-capitalize-mode "auto-capitalize" "Toggle `auto-capitalize' minor mode in the buffer." t)
(autoload 'turn-on-auto-capitalize-mode "auto-capitalize" "Turn on `auto-capitalize' minor mode in the buffer." t)
(autoload 'enable-auto-capitalize-mode "auto-capitalize" "Enable `auto-capitalize' minor mode in the buffer." t)

(setq auto-capitalize-yank t
      auto-capitalize-words '("\\<Emacs\\>" "\\<Linux\\>"
                              "\\<Android\>>" "\\<iOS\\>" "\\<Mac\\>")
      )

;; load those things before some hooks variables.
(require 'org)
(autoload 'org-mode-hook "org")
(require 'markdown-mode)
(autoload 'markdown-mode-hook "markdown-mode")

(dolist (hook '(text-mode-hook
                org-mode-hook
                markdown-mode-hook
                ;; latex-mode-hook
                ))
  (add-hook hook
            '(lambda ()
               ;; (auto-capitalize-mode)
               ;; (setq auto-capitalize t)
               ;; To turn on (unconditional) capitalization in all Text modes.
               (turn-on-auto-capitalize-mode)
               ;; To enable (interactive) capitalization in all Text modes.
               ;; (enable-auto-capitalize-mode)
               )
            ))

#+END_SRC