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: Sat, 22 Oct 2016 02:15:57 +0200 Message-ID: <877f911bnm.fsf@jupiter.lan> References: <87wph3n4d7.fsf@jupiter.lan> <87twc79gsa.fsf@web.de> <87eg3bhtcm.fsf@jupiter.lan> <87wph2j7e3.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1477117661 11381 195.159.176.226 (22 Oct 2016 06:27:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 22 Oct 2016 06:27:41 +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 Sat Oct 22 08:27:36 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 1bxpm2-0000FA-Hl for geh-help-gnu-emacs@m.gmane.org; Sat, 22 Oct 2016 08:27:18 +0200 Original-Received: from localhost ([::1]:35739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxpm4-00077A-Sk for geh-help-gnu-emacs@m.gmane.org; Sat, 22 Oct 2016 02:27:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxjzE-0001WV-1U for help-gnu-emacs@gnu.org; Fri, 21 Oct 2016 20:16:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxjzA-0007qP-TQ for help-gnu-emacs@gnu.org; Fri, 21 Oct 2016 20:16:32 -0400 Original-Received: from [195.159.176.226] (port=44037 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bxjzA-0007pK-MY for help-gnu-emacs@gnu.org; Fri, 21 Oct 2016 20:16:28 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1bxjyv-0005Yw-0N for help-gnu-emacs@gnu.org; Sat, 22 Oct 2016 02:16:13 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 106 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:zTDCKx319PkygK5XtnB9c0wuvCI= 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: Sat, 22 Oct 2016 02:25:03 -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:111591 Archived-At: Michael Heerdegen writes: > Ok, then please tell us a bit more about what you want to achieve, and > what the mode you want to define is supposed to do. Well, I am the author of kodi-remote.el it startet as some functions to send a video/youtube url to kodi and start music party-mode. But recently I startet to implement a whole remote for emacs. Basicly the idea is to have keyboard mode so you can control a kodi instance like you would have connected the keyboard direct on the machine that runs kodi. On top of that I have a kodi series mode that shows me at the moment the unseen stuff and lets me start a video. There I have other problems like getting the refresh functionality to work at the moment it only kind of refreshes if I restart the mode, and even that not really consistent. But that is another problem, but a similar one, cause its also about such special mode buffers (there I use tabulated mode). In the end I would want, if that makes sense have one major kodi-remote-buffer as start-point, and the other modes as sub-buffers. For this thread I was targeting the keyboard mode, functional wise it does what it should do, it sends kodi commands according to the keys you press. But I cant make this a empty special buffer, then most people would have no idea what to do if they start this mode/function. So I thought lets display the keybbindings for now. In the end maybe I dont know what would be best, a mouse interface, I dont know. But to get some sort of version out there I thought displaying the keybindings and a header line would be ok. Its just a bit much, trying to gasp emacs internals, elisp, the json-api from kodi and designing a good interface so I have to have milestones between that. Also the current patch will be huge anyway, so I am not trying to get all right, but have something a user can get around if he is a bit interested in such software. In the end there could be some minor modes, there could be youtube-eww integration etc, (I use it to send youtube-urls from other browsers like conkeror and qutebrowser with something like that: var cmd = '/usr/bin/emacsclient -e "(kodi-remote-play-video-url \\"{}\\")"' and hint links spawn emacsclient -e "(kodi-remote-play-video-url \"{hint-url}\")" y because I am to lazy to write for each browser a own youtube-plugin, but thats maybe to much detail now. So did you understand what I wanna do? I can give you the real source code not the abstracted here: (defvar kodi-remote-keyboard-mode-map (let ((map (make-sparse-keymap)) (menu-map (make-sparse-keymap))) .... (define-key map (kbd "-") 'kodi-remote-volume-decrease) (define-key map (kbd "") 'kodi-remote-toggle-fullscreen) map) "Keymap for kodi-remote-keyboard-mode.") (define-derived-mode kodi-remote-keyboard-mode special-mode "kodi-remote-keyboard" "Major mode for remote controlling kodi instance with keyboard commands Key bindings: \\{kodi-remote-keyboard-mode-map}" (toggle-read-only) (insert (concat "Kodi Remote:\n" (substitute-command-keys "\\{kodi-remote-keyboard-mode-map}") )) ) (defun kodi-remote-keyboard () "Open a `kodi-remote-keyboard-mode' buffer." (interactive) (let* ((name "*kodi-remote-keyboard*") (buffer (or (get-buffer name) (generate-new-buffer name)))) (unless (eq buffer (current-buffer)) (with-current-buffer buffer (unless (eq major-mode 'kodi-remote-keyboard-mode) (condition-case e (progn (kodi-remote-keyboard-mode) ) (error (kill-buffer buffer) (signal (car e) (cdr e)))))) (switch-to-buffer-other-window buffer)))) That should be the relevant part. greetings Stefan