[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] a quick way to switch orgmode notes between read-only/editing?
From: |
Thorsten Jolitz |
Subject: |
Re: [O] a quick way to switch orgmode notes between read-only/editing? |
Date: |
Fri, 18 Jul 2014 10:54:34 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Xebar Saram <address@hidden> writes:
> Thx again all, really cool.
>
> one last question. anyone mind pasting code to revert an open buffer
> to read only when idle for lets say 5 minutes?
you could try this (untested!):
#+begin_src emacs-lisp
(defvar tj/last-buffer-tick nil)
(make-variable-buffer-local 'tj/last-buffer-tick)
(add-hook 'org-mode-hook
(lambda ()
(setq tj/last-buffer-tick (buffer-modified-tick))))
(defun tj/new-buffer-ticks-p ()
(let ((curr-tick (buffer-modified-tick))
(last-tick tj/last-buffer-tick))
(setq tj/last-buffer-tick curr-tick)
(< last-tick curr-tick)))
(defun tj/reset-view-mode ()
(run-with-timer (* 5 60) (* 5 60)
(lambda ()
(when (tj/new-buffer-ticks-p)
(view-mode t)))))
#+end_src
> On Fri, Jul 18, 2014 at 2:42 AM, Eric Abrahamsen
> <address@hidden> wrote:
>
> Xebar Saram <address@hidden> writes:
>
> > Thanks guys. really appreciate all your help
> >
> > im now using view-mode with hooks as suggested. btw whats the
> > advantages of viewer-mode over read-only-mode
>
>
> Mostly that you get more convenient navigation commands. Scrolling
> and
> searching etc don't require control modifiers, and it becomes a
> bit
> easier to move around files.
>
>
>
> > best
> >
> > Z
> >
> >
> > On Thu, Jul 17, 2014 at 5:46 PM, Jorge A. Alfaro-Murillo <
> > address@hidden> wrote:
> >
> > Xebar Saram <address@hidden> writes:
> >
> > > i keep once and a while screwing up my notes with unintended
> > editing
> > > (erroneous key presses etc) and was wondering if any one knew
> > of a way
> > > to to switch orgmode notes between read-only/editing?
> >
> > Hi Xebar. Use C-x C-q. This works for every file, I use it in
> > particular
> > for notes that I do not want to edit.
> >
> > It runs the command read-only-mode which changes whether the
> > current
> > buffer is read-only. Actually the command switches the local
> > variable
> > buffer-read-only, so you can use that variable as local for
> every
> > file
> > that you do not want to edit by default. At the end of those
> > files add:
> >
> > #+BEGIN_EXAMPLE
> > %%% Local Variables:
> > %%% buffer-read-only: t
> > %%% End:
> > #+END_EXAMPLE
> >
> > And every time that you want to edit them just do C-x C-q
> >
> > Best,
> >
> > Jorge.
> >
> >
>
>
>
>
>
--
cheers,
Thorsten
- Re: [O] a quick way to switch orgmode notes between read-only/editing?, (continued)
- Re: [O] a quick way to switch orgmode notes between read-only/editing?, Jorge A. Alfaro-Murillo, 2014/07/17
- Re: [O] a quick way to switch orgmode notes between read-only/editing?, Xebar Saram, 2014/07/17
- Re: [O] a quick way to switch orgmode notes between read-only/editing?, Eric Abrahamsen, 2014/07/17
- Re: [O] a quick way to switch orgmode notes between read-only/editing?, Xebar Saram, 2014/07/18
- Re: [O] a quick way to switch orgmode notes between read-only/editing?,
Thorsten Jolitz <=
- Re: [O] a quick way to switch orgmode notes between read-only/editing?, Xebar Saram, 2014/07/18
- Re: [O] a quick way to switch orgmode notes between read-only/editing?, Thorsten Jolitz, 2014/07/18
- Re: [O] a quick way to switch orgmode notes between read-only/editing?, Xebar Saram, 2014/07/18
- Re: [O] a quick way to switch orgmode notes between read-only/editing?, Thorsten Jolitz, 2014/07/18