help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can't figure out how to create a tabulated-list-mode with visible


From: Stefan Huchler
Subject: Can't figure out how to create a tabulated-list-mode with visible
Date: Sun, 09 Oct 2016 18:08:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

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?







reply via email to

[Prev in Thread] Current Thread [Next in Thread]