I hope this is not to send a bad signal. I will answer my own question once more. The comments are very helpful in guiding me, however I have to use both my 'knowledge' of my setup, my laziness, and the good suggestions to come up with the following solution.
At first I thought bisecting as @Drew suggested is a tedious task. So I do M-x package-install RET bug-hunter
to do the bisection for me. bug-hunter
did not give back any problematic lines:
M-x bug-hunter-init-file RET e
Doing some initial tests...
Test failed.
No errors signaled after loading the entire file. If you're
looking for something that's not an error, you need to provide an
assertion. See this link for some examples:
https://github.com/Bruce-Connor/elisp-bug-hunter
I checked out the assertion part on github, but then I don't know what assertion to put for the problematic function mouse-drag-region
.
It seems to be a dead end. But the function name *-region
reminds me of some cool function I copied from EmacsWiki some time ago:
(do-all-symbols (symbol)
(when (and (commandp symbol t)
(string-match-p "-region$\\|kill-ring-save" (symbol-name symbol)))
(put symbol 'interactive-form
'(interactive
(if (use-region-p)
(list (region-beginning) (region-end))
(list (line-beginning-position) (line-beginning-position 2)))))))
then I opened my .emacs
in one instace and start comment that function out. I open another emacs instance and test links. Oh my gosh, it works.
The next question is how to fix the function. There several alternative for the functions on EmacsWiki (i.e. This one: http://emacswiki.org/emacs/CopyingWholeLines). By the way, I find EmacsWiki in many cases confusing because it shows all editing of a page, so it is hard to see which one really works.
Update
Following is the fix for both functions on the EmacsWiki that caused me losing some hair. Hope I can find out how/when to edit that EmacsWiki page. For now, here are the fixed functions:
;;;************************************************************
;; Smart copy and paste lines/regions
;; Use `my-kill-ring-save` by uncommenting it if you only want to handle
;; cut and copy the whole line without selecting it explicitly.
;; the `do-all-symbols` loop applies the same approach to all functions
;; that deal with regions.
;;
;; (defun my-kill-ring-save (beg end &optional flash)
;; (interactive (if (use-region-p)
;; (list (region-beginning) (region-end) nil)
;; (list (line-beginning-position 1)
;; (line-beginning-position 2) 'flash)))
;; (kill-ring-save beg end)
;; (when flash
;; (save-excursion
;; (if (equal (current-column) 0)
;; (goto-char end)
;; (goto-char beg))
;; (sit-for blink-matching-delay))))
;; (global-set-key [remap kill-ring-save] 'my-kill-ring-save)
;; Don't quite understand this code below
(do-all-symbols (symbol)
(when (and (commandp symbol t)
(string-match-p "-region$\\|kill-ring-save" (symbol-name symbol))
(not (string-match-p "mouse" (symbol-name symbol))))
(put symbol 'interactive-form
'(interactive
(if (use-region-p)
(list (region-beginning) (region-end))
(list (line-beginning-position) (line-beginning-position 2)))))))
;;;;************************************************************
debug-on-error
tot
and provoke the error. You get a backtrace that might contain some clues. Typeq
in the*Backtrace*
buffer when done with it, and setdebug-on-error
back tonil
if you don't fancy looking at backtraces every time something goes wrong.emacs -Q
.emacs -Q
makes the problem go away. I can for exampleC-h C-a
and Click on theAuthors
link and go the the intended author page. Whereas, in my normal emacs (running without-Q
), doing the same thing does not get anywhere and shows the error.comment-region
to comment out selected text (or uncomment it, withC-u
).