From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: [cvs] bug when using pc-selection-mode/transient-mark-mode Date: Sun, 22 Sep 2002 18:48:20 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: <200209222248.g8MMmKZ26653@rum.cs.yale.edu> References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1032735036 31899 127.0.0.1 (22 Sep 2002 22:50:36 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 22 Sep 2002 22:50:36 +0000 (UTC) Cc: Richard Stallman , emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17tFYh-0008IN-00 for ; Mon, 23 Sep 2002 00:50:35 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17tGEh-0004Ku-00 for ; Mon, 23 Sep 2002 01:33:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17tFYi-0003PP-00; Sun, 22 Sep 2002 18:50:36 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17tFWa-0003NA-00 for emacs-devel@gnu.org; Sun, 22 Sep 2002 18:48:24 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17tFWZ-0003Mv-00 for emacs-devel@gnu.org; Sun, 22 Sep 2002 18:48:24 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17tFWX-0003Md-00; Sun, 22 Sep 2002 18:48:21 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id g8MMmKZ26653; Sun, 22 Sep 2002 18:48:20 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Karl Chen Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:8101 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:8101 > HOWEVER, this is an ugly hack and I've noticed a lot of similar "save > deactivate_mark; do crap; restore deactivate_mark" code in Emacs. It just > smells of bad design when global variables have to be pushed and popped > all the time and someone calling a function needs to know which variables > to push/pop, especially when this is not documented. Some ideas for a > more elegant (i.e. a lot more troublesome to implement) solution: > > - per-buffer `deactivate-mark' variable. > - maybe prepare_to_modify_buffer doesn't need to set deactivate-mark > (probably does need to). > - a "temporary buffer" status for buffers that are such. Could be either > passed to get-buffer-create or set as a buffer-local variable. > - notice whether the buffer being modified by in prepare_to_MB is the > "active" one (current buffer? or any visible buffer) that the user has > a selection in (and if not assume it's a temporary buffer) > > In the meantime there should be a documented warning to emacs developers > that whenever they create and manipulate temporary buffers that they have > to save the deactivate-mark variable. `mark-active' is buffer-local and I think `deactivate-mark' should be buffer-local as well. But that begs the question "when do we check whether deactivate-mark was set and reset mark-active accordingly" ? Are we going to loop through all buffers, looking for ones with a non-nil deactivate-mark ? So maybe we should not make it buffer-local but instead make it hold a list of buffers whose mark should be deactivated. Currently we only use t or nil where t means "current-buffer". Stefan