From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [External] : Re: Emacs Survey: Toolbars Date: Fri, 26 Feb 2021 11:27:20 -0500 Message-ID: References: <87o8iv3ac3.fsf@gnus.org> <874kknp1lq.fsf@gnus.org> <838s7crozt.fsf@gnu.org> <87lfbbmd52.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5248"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Lars Ingebrigtsen , "emacs-devel@gnu.org" , Eli Zaretskii , Stefan Kangas To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 26 17:28:24 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lFfya-0001Gw-3F for ged-emacs-devel@m.gmane-mx.org; Fri, 26 Feb 2021 17:28:24 +0100 Original-Received: from localhost ([::1]:34804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFfyZ-00025S-67 for ged-emacs-devel@m.gmane-mx.org; Fri, 26 Feb 2021 11:28:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFfxm-0001bY-9f for emacs-devel@gnu.org; Fri, 26 Feb 2021 11:27:34 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:58673) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFfxd-0005qq-EH; Fri, 26 Feb 2021 11:27:33 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A22FE80BB0; Fri, 26 Feb 2021 11:27:23 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 47A428026B; Fri, 26 Feb 2021 11:27:22 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1614356842; bh=ZK+LLkw9PYy+0sgYJQGMXe/M6Dyx5ZiXWuVXM4Ysl6w=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=ABl1N1drQNzIR22n68mr5KhWLMj0/0Ff5mUvO4Jd1EUDN00Kz7jKzD9SErp7iCLMB HIoFTTHbxlXsLH66207rN8I1WmikBccEK/3Mig6qkJlDzAME9YgC9Y7knqS/PVesU1 w2pmn8g0nzocW6/Mh8o7D3Jo20p8Gli4sMEOtPRoHPOkuq1CdfqFMtulnsWLmFWIWN n8EyO4XPpG5p2vPmp6t0bh1Vkb7qIt/gT/iUEmUDqpkV7xovqeiRwJjl6xVgNpAtOs D/hxkHTbZbHDmtD4SiWhTldQdXn+emu+Ouma9f8Es6JjiNntNXKzQnnqo8KrUYuRFk Ajz3fgCXwrjQA== Original-Received: from alfajor (unknown [216.154.41.47]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E2E681200DC; Fri, 26 Feb 2021 11:27:21 -0500 (EST) In-Reply-To: (Drew Adams's message of "Fri, 26 Feb 2021 15:51:23 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:265685 Archived-At: > By "inside the window's text" do you mean anywhere > within it, so for example a user could move it I don't know what other people mean, but what I'm thinking of is reflected in the chunk of code below I started writing some years ago. You can `insert` the result into the buffer to put a toolbar wherever you want (don't expect miracles: it has loads of shortcomings). Stefan (defun tool-bar-to-string (&optional map) (let ((res "")) (map-keymap (lambda (k v) (when (eq (car v) 'menu-item) (let* ((name (nth 1 v)) ;Unused, AFAICT. (cmd (nth 2 v)) (plist (nthcdr (if (consp (nth 3 v)) 4 3) v)) (help-echo (plist-get plist :help)) (image (plist-get plist :image)) (button (propertize " " 'help-echo help-echo 'keymap (let ((map (make-sparse-keymap))) (define-key map [mouse-1] cmd) map) 'face 'tool-bar ;; 'custom-button 'mouse-face 'custom-button-mouse 'rear-nonsticky '(display keymap help-echo) 'display image))) (setq res (concat res (propertize " " 'display '(space :width 1) 'face 'custom-button ) button))))) (or map (key-binding [tool-bar]))) res))