From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: York Zhao Newsgroups: gmane.emacs.help Subject: Re: How to add property for a buffer object Date: Wed, 12 Sep 2012 14:49:40 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1347475798 7225 80.91.229.3 (12 Sep 2012 18:49:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Sep 2012 18:49:58 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Sep 12 20:50:00 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TBs0W-0001W7-Rh for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Sep 2012 20:49:53 +0200 Original-Received: from localhost ([::1]:45453 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBs0S-0000Sf-Mv for geh-help-gnu-emacs@m.gmane.org; Wed, 12 Sep 2012 14:49:48 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBs0M-0000RR-U4 for help-gnu-emacs@gnu.org; Wed, 12 Sep 2012 14:49:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBs0L-0003H3-KJ for help-gnu-emacs@gnu.org; Wed, 12 Sep 2012 14:49:42 -0400 Original-Received: from mail-vb0-f41.google.com ([209.85.212.41]:50076) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBs0L-0003Gs-FV for help-gnu-emacs@gnu.org; Wed, 12 Sep 2012 14:49:41 -0400 Original-Received: by vbkv13 with SMTP id v13so3092044vbk.0 for ; Wed, 12 Sep 2012 11:49:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ardd/7F0G8+1KTBvOhHn+dh4v4g2P1MtlJ7CPXYWUGc=; b=iiUgOmGZJ9zrWQm2n8/fMY0+anr+G3YdLXkIhssoefAhS4D0M83EzaMXRueVGL8f6M 3wLCYmUdyxYmAuUni69nzVgJcjF9U8/6G1PjJcg1LpEYYmc1YZ1qn5Jwa+8HRHoeUGW3 QIPTIs9lL2B0SZFScfTUxdrmBjI9FwW6pC5XmeItj47ydjz9zf9jWAONZBVXbY4VbtSA t0+K+Bc2wZbHZA5JTZuI75yceBlndchcimuXhzqZ83ToQ39gK/Zcta3NK01EvOgnbG43 yJS5Wa4zdtt0k9BlhFgwAYZkJYUg0Obcg1QMRXOH+vcH0RaEmWL7BKipLXaWpNy9g/PX sUEw== Original-Received: by 10.52.31.66 with SMTP id y2mr23469081vdh.122.1347475780836; Wed, 12 Sep 2012 11:49:40 -0700 (PDT) Original-Received: by 10.52.185.194 with HTTP; Wed, 12 Sep 2012 11:49:40 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.41 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:86736 Archived-At: >> > You can use `get' and `put' on the symbol that is the value >> > of variable `major-mode'. >> >> I don't think this would help because I need to attach >> something to the buffer, not all the buffers in the major-mode. > > Or you could keep track of which buffers in the mode you care about this way. > IOW, work with a list of buffers instead of setting and getting a property for > each of those buffers. Yes I could do this, but this will be a lot more work than if we could set property directly to buffer object. > That's about it, IIRC. But usually other Lisp objects that you might want to > assign a property to are somehow associated with one or more of those things, so > you can just assign the property to the associated thing (e.g., to a symbol). > For a buffer, as an alternative to a buffer-local variable or a list of affected > buffers, you could put a property on a symbol whose name is the same as the > buffer name. Or you could put a text property on a string that is `string=' to > the buffer name. But I think you will have to make a symbol for the buffer, and delete the symbol when the buffer gets killed, right? Again, a lot more work. > Or if you can depend on some of the buffer text remaining the > same, you could put a text property on some buffer position (e.g. (point-min)). I think this is feasible. >> The major problem with `refill-mode' however, is that it intercepts >> the "fill-function" therefor was not able to handle refilling >> properly in org-mode, especially, it would mess up org tables. >> Also, if you have `refill-mode' turned on, you will never be able >> to break a paragraph into two by hitting while >> the point is in the middle of the paragraph. > > Sounds like there should be a bug report or enhancement request in there > somewhere. ;-) `M-x report-emacs-bug'. I will probably send the bug, but I some times sort of lack the motivation to report bug to a large project, as I'm not sure how long their "TODO" list is, and I'm afraid that once it gets into somebody's "TODO" list, chances are that it will never be touched :-). >> On the other hand, the `auto-fill-mode' never "auto-fill" when >> inserting text in the middle of a line, because of this, I have >> to hit "M-q" all the time. Do you know of any other way >> to really handle "auto-fill" property? > > No, I'm probably not the right one to ask. But hopefully someone else will have > a suggestion. I use `M-q' and `C-M-q' (e.g. in Lisp code). > > There are also other fill commands, which operate on multiple paragraphs in the > region: `fill-region', `fill-individual-paragraphs', and > `fill-nonuniform-paragraphs'. When one of them does what you want, you might be > able to use it in place of several uses of `M-q'. I think you missed my point here. I don't have problem with "M-q", it actually works perfectly. But my problem is that I have to hit "M-q" all the time. What I'm looking for is something like "refill-mode" so that I don't have to always hit "M-q" while inserting or deleting text in the middle of a line. My fingers hurt a lot so I always try to hit as less keys as possible. Thanks, York