From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Engster Newsgroups: gmane.emacs.devel Subject: Re: "Adobe Brackets like" editing in emacs Date: Thu, 20 Mar 2014 17:59:50 +0100 Message-ID: <87a9ckerg9.fsf@engster.org> References: <87txav5jnz.fsf@lifelogs.com> <87d2hi5p6n.fsf@lifelogs.com> <87wqfp4cck.fsf@lifelogs.com> <837g7o96mb.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1395334800 18240 80.91.229.3 (20 Mar 2014 17:00:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Mar 2014 17:00:00 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 20 18:00:10 2014 Return-path: Envelope-to: ged-emacs-devel@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 1WQgKA-0002Ua-1v for ged-emacs-devel@m.gmane.org; Thu, 20 Mar 2014 18:00:10 +0100 Original-Received: from localhost ([::1]:48355 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQgK9-0003YL-LM for ged-emacs-devel@m.gmane.org; Thu, 20 Mar 2014 13:00:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55886) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQgK0-0003Ts-IO for emacs-devel@gnu.org; Thu, 20 Mar 2014 13:00:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQgJu-0004Eq-Ht for emacs-devel@gnu.org; Thu, 20 Mar 2014 13:00:00 -0400 Original-Received: from randomsample.de ([5.45.97.173]:42085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQgJu-0004Ek-8R; Thu, 20 Mar 2014 12:59:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomsample.de; s=a; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From; bh=NyoQ/bO6OzqyR1pMv2FYty2m6ZeecDfF0r6JjRWZhpE=; b=EMMDfx5jpxh1bSL+GRuRAnjEHCKwsE2KTs2jPNXn8oF9xsiDwlhh1+qDIGmZ/4aGxuwfcUvGcX+ZI242vVNnTNcu4EHyEMehk4fHkvVOQvuiDjZVTDHXvyvoAGkJ7BH4; Original-Received: from dslc-082-083-058-249.pools.arcor-ip.net ([82.83.58.249] helo=spaten) by randomsample.de with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1WQgJs-0006R1-9M; Thu, 20 Mar 2014 17:59:52 +0100 In-Reply-To: <837g7o96mb.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 20 Mar 2014 18:28:44 +0200") User-Agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.3 (gnu/linux) Mail-Followup-To: Eli Zaretskii , emacs-devel@gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 5.45.97.173 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:170634 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: > I suggested to have this feature first based on the existing > infrastructure, i.e. in another window. This should be easy to > implement, and will allow collecting user experience which we > currently lack. Then decision of whether we need a new UI, and which > one, will be based on something, rather than on thin air. OK, I've hacked up a little demonstrator. Load the attached file and eval-buffer it (preferably with 'emacs -Q', that's how I tested it). Then move point over an Emacs function; hitting 'C-c e' will open the quick-edit window with the function's definition, and 'C-c c' will close it. Problems I've noticed so far: - mode-line-format is buffer-local, so you cannot deactivate it only for the upper window. That means, while in quick-edit, you will have no mode-line at all. - You cannot set a different background color for a complete window. You can only do that with an overlay, but that will only cover the parts with text. - Of course, you can easily mess things up be leaving/closing the window otherwise. In a nutshell, it'd be nice to have something like 'window-local' variables for this. -David --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=quick-edit-demo.el Content-Transfer-Encoding: quoted-printable (global-set-key (kbd "C-c e") 'quick-edit) (global-set-key (kbd "C-c c") 'quick-edit-close) (defvar quick-edit-window-height 15) (defvar quick-edit-window nil) (defvar quick-edit-upper-window nil) (defvar quick-edit-lower-window nil) (defvar quick-edit-old-mlf nil) (defun quick-edit () (interactive) (if (null (symbol-function (symbol-at-point))) (message "Could not find definition") (quick-edit-create-window) (find-function (symbol-at-point)) (narrow-to-defun) (setq mode-line-format nil) (set-window-margins nil 10) (let ((ov (make-overlay (point-min) (point-max)))) (overlay-put ov 'face '(:background "light gray")) (overlay-put ov 'before-string (propertize " " 'display '((margin left-margin) "QUICK EDIT")))))) (defun quick-edit-create-window () (setq quick-edit-old-mlf mode-line-format) (setq quick-edit-upper-window (selected-window)) (setq mode-line-format nil) (split-window-vertically (line-number-at-pos)) (redisplay t) (let ((end (window-end))) (other-window 1) (split-window-vertically quick-edit-window-height) (setq quick-edit-window (selected-window)) (other-window 1) (set-window-start (selected-window) end) (setq quick-edit-lower-window (selected-window)) (select-window quick-edit-window t))) (defun quick-edit-close () (interactive) (delete-window quick-edit-lower-window) (delete-window quick-edit-window) (select-window quick-edit-upper-window t) (setq mode-line-format quick-edit-old-mlf)) --=-=-=--