[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
 Feature request - testarea editing in full sized Org-mode buffers
- From: Thorsten Jolitz <tjolitz@xxxxxxxxx>
- Date: Wed, 02 Oct 2013 08:00:57 +0200
- X-ml-name: emacs-w3m
- X-mail-count: 12150
Hi List, 
* Szenario 1
I would like to have an alternative version of textarea editing with
emacs-w3m for the situation that the textarea holds an Org-mode (.org) file:
 - use `split-window-sensibly' to produce a normal sized edit buffer
 - set that buffer to org-mode with minor-mode w3m-form-textarea-edit-mode
   activated (with keybindings that do not conflict with Org-mode)
 - (and of course fix the issue of lost edits when submitting the edit-buffer)
And maybe introduce a variable like 
#+begin_src emacs-lisp
(defvar w3m-form-textarea-edit-in-org-mode-p nil
  "Use org-mode for editing textareas when non-nil")
#+end_src
and a function like
#+begin_src emacs-lisp
  (defun w3m-form-toggle-textarea-edit-in-org-mode ()
    "Toggle editing textareas in Org-mode.
  
    When off, textareas are edited in text-mode, otherwise in
    org-mode. With prefix argument ARG, use org-mode if ARG is
    positive, otherwise text-mode."
    (interactive "P")
    (setq w3m-form-textarea-edit-in-org-mode-p
          (if (null arg)
              (not w3m-form-textarea-edit-in-org-mode-p)
            (> (prefix-numeric-value arg) 0)))
    (message "Edit textarea in Org-mode %s"
             (if w3m-form-textarea-edit-in-org-mode-p "enabled" "disabled")))
  
#+end_src
* Scenario 2
Actually, I could (and already did) implement this very easily using a bit of
trickery with my own library `outorg.el'. But this library depends heavily on
comment syntax - and text-mode has no comment syntax defined. Thus the whole
thing works, but with at least two prompts for comment-syntax, which is too
inconvenient for regular use.
Setting comment-{start|end|add|padding} myself first did not work - somehow
the settings don't take place immediately and I'm stilled prompted for
'comment-start' later on. 
So *all* that might be needed for this feature is actually
,-----------------------------------------------
| (set (make-local-variable 'comment-start) "#")
`-----------------------------------------------
early enough so that comment-start is already defined in the textarea
edit-buffer when I do my little outorg trickery. 
Would that be easy to implement?
-- 
cheers,
Thorsten