Subject: 24.3; require sets deactivate-mark causing problems with some plugins

From: Donald Curtis <[email-masked]>
Date: Fri, 24 May 2013 13:07:24 -0500

This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgment at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':

I am using the `multiple-cursors` package through `package.el` which
sets up some autoloads that rely on the currently selected region. When
I call the function---through a keybinding---the current region
deactivates. The problem is that subsequent calls to the function
require that the region stay active.

It appears that somewhere during the call to `require`,
`deactivate-mark` is being set to `t` and thus the mark gets deactivated.

The only solution that I have been able to come up with is to advise
around `require` and create a local instance of `deactivate-mark` while
saving the excursion.

(defadvice require (around require-advice (feature &optional filename noerror) activate)
  (save-excursion
    (let (deactivate-mark)
      ad-do-it)))

It seems like there should be a way to avoid this behavior more elegantly.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/local/Cellar/emacs/24.3/share/emacs/24.3/etc/DEBUG.

In GNU Emacs 24.3.1 (x86_64-apple-darwin12.3.0, NS apple-appkit-1187.37)
of 2013-05-24 on charlie.local
Windowing system distributor `Apple', version 10.3.1187
Configured using:
`configure '--prefix=/usr/local/Cellar/emacs/24.3' '--without-dbus'
'--enable-locallisppath=/usr/local/share/emacs/site-lisp'
'--infodir=/usr/local/Cellar/emacs/24.3/share/info/emacs' '--with-ns'
'--disable-ns-self-contained' 'CC=cc''

Important settings:
  locale-coding-system: utf-8
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  paredit-mode: t
  yas-minor-mode: t
  rainbow-delimiters-mode: t
  whitespace-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  ido-ubiquitous-mode: t
  ido-everywhere: t
  which-function-mode: t
  delete-selection-mode: t
  global-subword-mode: t
  subword-mode: t
  winner-mode: t
  show-paren-mode: t
  savehist-mode: t
  shell-dirtrack-mode: t
  global-auto-revert-mode: t
  recentf-mode: t
  checkdoc-minor-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x b t e s t <return> C-= C-> C-g C-n C-n C-n C-n 
C-n C-n C-n C-n C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-= C-> C-> C-g C-g C-x b i n i C-g C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-p C-SPC C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n M-w C-x RET e m a c s b u <return> M-p M-p 
M-p M-p <return> C-y C-c C-c y C-x C-g C-x RET <return> 
M-p M-p <return> C-y C-c C-c y C-x RET <return>

Recent messages:
Checking 87 files in /usr/local/Cellar/emacs/24.3/share/emacs/24.3/lisp/calc...
Checking 77 files in /usr/local/Cellar/emacs/24.3/share/emacs/24.3/lisp/obsolete...
Checking 1 files in /usr/local/Cellar/emacs/24.3/share/emacs/24.3/leim...
Checking for load-path shadows...done
Mark set [2 times]
Send this bug report to the Emacs maintainers? (y or n)  y
Sending...
Mark set [2 times]
Sending via mail...
Sending...done

Load-path shadows:
/Users/dcurtis/.emacs.d/elpa/multiple-cursors-20130518.816/rectangular-region-mode hides ~/src/multiple-cursors.el/rectangular-region-mode
/Users/dcurtis/.emacs.d/elpa/multiple-cursors-20130518.816/multiple-cursors hides ~/src/multiple-cursors.el/multiple-cursors
/Users/dcurtis/.emacs.d/elpa/multiple-cursors-20130518.816/multiple-cursors-pkg hides ~/src/multiple-cursors.el/multiple-cursors-pkg
/Users/dcurtis/.emacs.d/elpa/multiple-cursors-20130518.816/multiple-cursors-core hides ~/src/multiple-cursors.el/multiple-cursors-core
/Users/dcurtis/.emacs.d/elpa/multiple-cursors-20130518.816/mc-separate-operations hides ~/src/multiple-cursors.el/mc-separate-operations
/Users/dcurtis/.emacs.d/elpa/multiple-cursors-20130518.816/mc-mark-more hides ~/src/multiple-cursors.el/mc-mark-more
/Users/dcurtis/.emacs.d/elpa/multiple-cursors-20130518.816/mc-edit-lines hides ~/src/multiple-cursors.el/mc-edit-lines
/Users/dcurtis/.emacs.d/elpa/multiple-cursors-20130518.816/mc-cycle-cursors hides ~/src/multiple-cursors.el/mc-cycle-cursors
/Users/dcurtis/.emacs.d/elpa/magit-20130523.125/.dir-locals hides /usr/local/Cellar/emacs/24.3/share/emacs/24.3/lisp/gnus/.dir-locals

Features:
(mailalias mailclient browse-url shadow sort mail-extr emacsbug message
cl-macs gv rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mail-utils mc-mark-more multiple-cursors-core rect
expand-region text-mode-expansions er-basic-expansions
expand-region-custom expand-region-core add-log paredit yasnippet cl
rainbow-delimiters whitespace rx undo-tree diff smex ido-ubiquitous ido
diminish which-func imenu delsel subword winner paren savehist
tramp-cache tramp-sh tramp tramp-compat auth-source gnus-util mm-util
mail-prsvr password-cache tramp-loaddefs shell pcomplete comint
ansi-color ring format-spec autorevert edmacro kmacro server uniquify
warnings advice help-fns cl-lib advice-preload saveplace recentf
tree-widget wid-edit misc midnight checkdoc thingatpt help-mode easymenu
ace-jump-mode-autoloads ag-autoloads browse-kill-ring-autoloads
clojure-mode-autoloads deft-autoloads diminish-autoloads
dired+-autoloads dropdown-list-autoloads expand-region-autoloads
gist-autoloads gh-autoloads eieio byte-opt bytecomp byte-compile cconv
git-commit-mode-autoloads ido-ubiquitous-autoloads
iy-go-to-char-autoloads logito-autoloads magit-autoloads
markdown-mode+-autoloads markdown-mode-autoloads
multiple-cursors-autoloads naquadah-theme-autoloads paredit-autoloads
pcache-autoloads rainbow-delimiters-autoloads smex-autoloads
soothe-theme-autoloads finder-inf undo-tree-autoloads
yasnippet-autoloads package time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel ns-win tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process ns multi-tty emacs)