From: Stefan Huchler <stefan.huchler@mail.de>
To: help-gnu-emacs@gnu.org
Subject: Re: special-mode buffer changes to fundamental when modified
Date: Sat, 22 Oct 2016 02:15:57 +0200 [thread overview]
Message-ID: <877f911bnm.fsf@jupiter.lan> (raw)
In-Reply-To: 87wph2j7e3.fsf@web.de
Michael Heerdegen <michael_heerdegen@web.de> 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 "<tab>") '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
next prev parent reply other threads:[~2016-10-22 0:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-20 2:25 special-mode buffer changes to fundamental when modified Stefan Huchler
2016-10-20 15:33 ` Michael Heerdegen
2016-10-20 16:34 ` Stefan Huchler
2016-10-21 10:58 ` Michael Heerdegen
2016-10-22 0:15 ` Stefan Huchler [this message]
2016-10-23 11:41 ` Michael Heerdegen
2016-10-23 12:58 ` Stefan Huchler
2016-10-23 16:24 ` Michael Heerdegen
2016-10-23 16:47 ` Stefan Huchler
2016-10-27 16:59 ` Michael Heerdegen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877f911bnm.fsf@jupiter.lan \
--to=stefan.huchler@mail.de \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.