emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Script to get org-mode working on your cell phone.
@ 2009-07-24 14:56 meingbg
  2009-07-24 16:41 ` Eric S Fraga
  0 siblings, 1 reply; 2+ messages in thread
From: meingbg @ 2009-07-24 14:56 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1378 bytes --]

Hi,

I recently ran across this comment in the org-mode survey:


> I'm on the lookout for a cell phone that runs Emacs, but… I haven't
> found any mechanisms for remotely adding/editing timestamps,
> changing the state of TODO items, etc. Neither have I found a way
> to trigger reminder sounds, e-mails, phone calls, or IM messages.
> I'm not sure about the best way to approach "mobile org-mode"…
> A web-interface like Webjimbo? More robust import/export/sync to
> iCal or GData? If we can find a way to usefully sync org-mode with
> mobile devices, it'll be just about perfect.


After reading that comment, I wrote cellphone.el that makes it possible to
actually do stuff in emacs on your cell phone.
I have a cell phone with a ssh app, a (very) small qwerty keyboard and
left/right arrow keys, but since there's no Ctrl or Alt keys, working in
Emacs is a pain (every time you need the Ctrl key, you need to go through a
menu). cellphone.el works by setting up several "cellphone keymaps". Each
cellphone keymap binds the letter keys a-z to commands of your choice. An
"orgmode" keymap is included as an example. You can easily select the keymap
with left/right arrow keys.

Please let me know your opinion about the script, as well as any tips of
getting more productive with orgmode on your cell phone.

The script is attached.

//meingbg

[-- Attachment #1.2: Type: text/html, Size: 1503 bytes --]

[-- Attachment #2: meingbg-cellphonemode.el --]
[-- Type: application/octet-stream, Size: 3231 bytes --]

;Author and Copyright 2009: meingbg, email: meingbg at gmail dot com
;License: BSD

;cellphonemode.el is not a real mode for emacs; rather, it's a
;startup script for making it easier to work in emacs on a cell
;phone (through ssh etc)

;When you're on a cell phone, type M-x cellphone-on <RET>

;functions to make the letter keys have different meaning dependent on
;which cellphone keymap is active
(defun cellphone-switch-map (mapname)
  (let ((map (member mapname cellphone-maps)))
    (when map
      (cellphone-cleanmap)
      (cellphone-bind (cadr map))
      (setq cellphone-current-map mapname)
      (message "%s" (concat "KEYBOARD: " mapname)))))
(defun cellphone-bind (bindings)
  (when (cdr bindings)
    (let ((key (car bindings)) (bind (cadr bindings)))
      (cond ((symbolp bind) (global-set-key key bind))
            ((or (vectorp bind) (stringp bind))
             (let ((bf (key-binding bind)))
               (if (symbolp bf) (global-set-key key bf))))))
    (cellphone-bind (cddr bindings))))
(defun cellphone-cleanmap ()
  (mapcar (lambda (x) (global-set-key x 'self-insert-command))
          '("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m"
            "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"
            "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "," ".")))
(defun cellphone-switch-map-next ()
  (interactive)
  (let ((a (apply #'list cellphone-maps)))
    (setcdr (last a) a)
    (cellphone-switch-map (nth 2 (member cellphone-current-map a)))))
(defun cellphone-switch-map-previous ()
  (interactive)
  (let ((a (apply #'list (reverse cellphone-maps))))
    (setcdr (last a) a)
    (cellphone-switch-map (nth 2 (member cellphone-current-map a)))))
(setq cellphone-off-menu-bar-mode menu-bar-mode)

;Make left and right arrow keys switch cellphone keymap
(defun cellphone-on ()
  (interactive)
  (menu-bar-mode 0)
  (global-set-key [right] 'cellphone-switch-map-next)
  (global-set-key [left] 'cellphone-switch-map-previous)
  (cellphone-switch-map (car cellphone-maps)))
(defun cellphone-off ()
  (interactive)
  (cellphone-cleanmap)
  (menu-bar-mode (if cellphone-off-menu-bar-mode 1 0))
  (global-set-key [right] 'forward-char)
  (global-set-key [left] 'backward-char))



;Define cellphone keymaps                  <<< This is where you CUSTOMIZE
(setq cellphone-current-map "off"
;Each cellphone keymap is defined by two items in cellphone-maps.
;First the name as a string, then a list defining the bindings.
;Each binding is defined by two items in the binding list. First
;a string containing the character two be bound to a function,
;then either a function name it should be bound to or a key
;combination that currently is bound to the desired function.
      cellphone-maps '(
"off"
()
"Movement"
("i" [?\C-p] "j" [?\C-b] "k" [?\C-n] "l" [?\C-f])
"orgmode"
("f" [?\C-c ?\C-n] "d" [?\C-c ?\C-p] "r" [?\C-c ?\C-f] "e" [?\C-c ?\C-b] "u" [?\C-c ?\C-u] "n" [C-return] "h" [?\C-c return] "i" [M-S-up] "j" [M-S-left] "k" [M-S-down] "l" [M-S-right] "w" [?\C-c ?\C-x ?\C-w] "y" [?\C-c ?\C-x ?\C-y] "s" [?\C-c ?/ ?r] "a" [?\C-c ?/] "o" [?\C-c ?\C-o] "t" [?\C-c ?\C-t] "8" [?\C-c ?\C-x ?\C-i] "9" [?\C-c ?\C-x ?\C-o] "7" [?\C-c ?\C-x ?\C-r] "0" fixa-org-klocka "g" [tab] "b" [S-tab])

))

[-- Attachment #3: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Script to get org-mode working on your cell phone.
  2009-07-24 14:56 Script to get org-mode working on your cell phone meingbg
@ 2009-07-24 16:41 ` Eric S Fraga
  0 siblings, 0 replies; 2+ messages in thread
From: Eric S Fraga @ 2009-07-24 16:41 UTC (permalink / raw)
  To: meingbg; +Cc: emacs-orgmode

At Fri, 24 Jul 2009 16:56:24 +0200,
meingbg wrote:

[...]

> After reading that comment, I wrote cellphone.el that makes it possible to
> actually do stuff in emacs on your cell phone.

Thanks.  This looks quite useful for use on my Nokia N800 (not a
phone; it's an internet tablet but it's just a little bigger than a
phone).  I like the concept of your switchable keymaps.  I'll let you
know how I get on when I get around to trying it out!

eric

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-24 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-24 14:56 Script to get org-mode working on your cell phone meingbg
2009-07-24 16:41 ` Eric S Fraga

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).