From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Huchler Newsgroups: gmane.emacs.help Subject: Re: special-mode buffer changes to fundamental when modified Date: Thu, 20 Oct 2016 18:34:49 +0200 Message-ID: <87eg3bhtcm.fsf@jupiter.lan> References: <87wph3n4d7.fsf@jupiter.lan> <87twc79gsa.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1476989313 21317 195.159.176.226 (20 Oct 2016 18:48:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 20 Oct 2016 18:48:33 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 20 20:48:28 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bxIO8-0004Gb-53 for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Oct 2016 20:48:24 +0200 Original-Received: from localhost ([::1]:56588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxIOA-0007Md-8s for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Oct 2016 14:48:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxGJV-0000Lw-7U for help-gnu-emacs@gnu.org; Thu, 20 Oct 2016 12:35:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxGJP-00064r-5a for help-gnu-emacs@gnu.org; Thu, 20 Oct 2016 12:35:29 -0400 Original-Received: from [195.159.176.226] (port=51992 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bxGJO-00064a-Uw for help-gnu-emacs@gnu.org; Thu, 20 Oct 2016 12:35:23 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1bxGJG-0004j6-Po for help-gnu-emacs@gnu.org; Thu, 20 Oct 2016 18:35:14 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 49 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:aOdZWLMqnCDACaH+3UBjpV+Hgo4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-Mailman-Approved-At: Thu, 20 Oct 2016 14:48:01 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:111578 Archived-At: Michael Heerdegen writes: > That looks very strange. A mode definition should not make a particular > buffer current. It should work in any (current) buffer where the mode > is enabled. Again I used first other methods like with-temp-buffer and stuff like that, but it always either dont insert the stuff I want, or it changes the mode of the buffer to fundamental mode. >> but then its no special mode buffer anymore, and it overwrites my >> keymaps. Without the with-current-buffer-window macro it works it >> supposed to be but the buffer is empty. > > Hard to guess what you want to do. Maybe you confuse `print' with > `insert' or something else? I used first princ or prin1 doesnt fix it. If I try insert, it tells me that its read only. I dont confuse it, just in the source of other mode, people often if not always use something like with-temp-buffer to insert content there. I want to have some text in the new buffer, thats what I want to do. > > In Emacs, trial and error doesn't work most of the time, you'll get > always "error" ;-) Yes because of that, I wrote this question, else I would gone more try & error. The try and error were some sort of last resort, cause the api documentation is pretty bad on this aspect. Also there are no simple examples out there too, the real "documentation" you get to develop such modes is looking the source of other modes. And they are often very complex, I dont know every of the 5000 elisp functions so its hard to read that often very complex code, when I only want to make pretty simple stuff. So insert does not work, too, including toggle-read-only before that (nor is it meant to be used in source). its not that I gone for strange with-*-buffer functions because it was the obvious way to do so, its because insert does not work for read-only-buffers and people use this with-* constructs in similar buffers/modes apperently for that purpose.