From: Stefan Huchler <stefan.huchler@mail.de>
To: help-gnu-emacs@gnu.org
Subject: Can't figure out how to create a tabulated-list-mode with visible
Date: Sun, 09 Oct 2016 18:08:48 +0200 [thread overview]
Message-ID: <87lgxxfqsv.fsf@jupiter.lan> (raw)
Hi,
I tried to upgrade my few kodi-remote functions to a basic major
mode. Primary to control kodi like you would do with a usb-keyboard but
over network within emacs.
So the basic stuff works so far, you can navigate start/pause/stop
delete a selected file and some stuff like that, with the standard
keyboard configuration.
https://github.com/spiderbit/kodi-remote.el
(its also in melpa)
the problem is, that in this form it only creates a empty special buffer,
which provides the right keybindings and forwards them to the kodi
instance but doesnt show anything.
I am not shure how you can print something into that read-only buffer, I
then thought next logical step besides a remote-keyboard would be to
list movies and series and stuff like that, and tabulated-list-mode
would make probably sense for that.
I looked into the code of other tabulated list modes like transmission
or proced, but they are pretty complex.
So I looked up the official documentation and tried to make a minimal
implementation that displays anything, but I did not succeed the buffer
stays empty, here my attempt:
(define-derived-mode kodi-remote-mode tabulated-list-mode "kodi-remote"
"Major mode for remote controlling kodi instance
Key bindings:
\\{kodi-remote-mode-map}"
;; :group '
;; (setq-local line-move-visual nil)
(setq tabulated-list-format [("choice" nil t)])
(setq tabulated-list-entries (nil ["Series"]))
(tabulated-list-init-header)
(tabulated-list-print)
)
;;;###autoload
(defun kodi-remote ()
"Open a `kodi-remote-mode' buffer."
(interactive)
(let* ((name "*kodi-remote*")
(buffer (or (get-buffer name)
(generate-new-buffer name))))
(unless (eq buffer (current-buffer))
(with-current-buffer buffer
(unless (eq major-mode 'kodi-remote-mode)
(condition-case e
(progn
(kodi-remote-mode)
)
(error
(kill-buffer buffer)
(signal (car e) (cdr e))))))
(switch-to-buffer-other-window buffer))))
what did I miss?
next reply other threads:[~2016-10-09 16:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-09 16:08 Stefan Huchler [this message]
2016-10-11 1:30 ` Can't figure out how to create a tabulated-list-mode with visible Michael Heerdegen
2016-10-12 1:38 ` Stefan Huchler
2016-10-12 9:28 ` 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=87lgxxfqsv.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.