I am getting the following error, but am finding it difficult to locate the problem. Are there any tools for debugging in such instances?
Warning (initialization): An error occurred while loading ‘/home/hagbard/.emacs’: Invalid read syntax: ) To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the ‘--debug-init’ option to view a complete error backtrace.
Have tried to locate the extra right parenthesis in the code, but been unsuccessful. Do not know quite well how to interpret the backtrace after doing
Debugger entered--Lisp error: (invalid-read-syntax ")") read(#<buffer *load*-313398>) eval-buffer(#<buffer *load*-313398> nil "/home/hagbard/Opstk/bin/typex/rk..." nil t) ; Reading at buffer position 8476 load-with-code-conversion("/home/hagbard/Opstk/bin/typex/rk..." "/home/hagbard/Opstk/bin/typex/rk..." nil t) require(rk "rk-bracemarks") mrk-bracemarks() launch-marsha() typex-marsha-config() typex-launch() eval-buffer(#<buffer *load*> nil "/home/hagbard/.emacs" nil t) ; Reading at buffer position 1368 load-with-code-conversion("/home/hagbard/.emacs" "/home/hagbard/.emacs" t t) load("~/.emacs" noerror nomessage) startup--load-user-init-file(#f(compiled-function () #<bytecode 0x155f192fd1f1>) #f(compiled-function () #<bytecode 0x155f192fd205>) t) command-line() normal-top-level()
Have clicked on the buffer position giving me this part of the code
(defun word-count-analysis (rgn-beg rgn-end &optional skip-words mxlen) "Count times each word is used in a region, ignoring punctuation.
RGN-BEG Start of region RGN-END End of region SKIP-WORDS Words to ignore MXLEN Maximum length of word
Third optional parameter is a list of words to ignore; fourth means ignore words shortern than len."
(defun word-count-analysis (rgn-beg rgn-end &optional skip-words mxlen) "Count times each word is used in a region, ignoring punctuation. RGN-BEG Start of region. RGN-END End of region. SKIP-WORDS Words to ignore. MXLEN Minimum length of word." (interactive "rxp") (let ( ($cur-table (syntax-table)) $words $word-str $word $cell ) (set-syntax-table word-count-analysis-syntax-table) (save-excursion (goto-char reg-beg) (while (re-search-forward "\\w+" reg-end t) (setq $word-str (downcase (match-string 0))) ;; Keep punctuation in words (e.g. 5.10 and 4,300) but not if ;; punctuation occurs at the end of a word. (if (string-match "\\(.+\\)[,.]$" $word-str) (setq $word-str (match-string 1 $word-str))) (setq $word (intern $word-str)) (setq $cell (assq $word $words)) (if (and (not (eq $word ',)) ; ignore comma at end of words (not (eq $word '.)) ; ignore period stop at end of words (or (not mxlen) (> (length $word-str) mxlen)) (or (not skip-words) (not (memq $word skip-words)))) (if $cell (setcdr $cell (1+ (cdr $cell))) (setq $words (cons (cons $word 1) $words)))) )) ;; restore table (set-syntax-table cur-table) (when (interactive-p) (message "%S" $words)) $words))