Re: [O] a quick way to switch orgmode notes between read-only/editing?

2014-07-18 Thread Thorsten Jolitz
Xebar Saram  writes:

> Thx again Thorsten
>
> for some reason it wont work here. i evaluated it and have in in my
> config. i open notes in view mode (the other hook i used) and then
> edit them. i leave the pc for 5-10 minutes but it dosent revert to
> view mode for some reason. am i missing something?

it should probably be

(= last-tick curr-tick) ;  was (< last-tick curr-tick)

but anyway, I'm not sure if this whole idea is a good one, and trying it
out here had some unwanted side-effects that had me restart Emacs. 

maybe try it out with the = (instead of <) and set (* 5 60) to (* 1 60)
so you only have to wait one minute...

if it does not work then, or wrecks havoc on you system, better omit
the whole thing. 

> On Fri, Jul 18, 2014 at 3:35 PM, Thorsten Jolitz 
> wrote:
>
> Xebar Saram  writes:
> 
> > Thx Thorsten
> >
> > i tried that but that dosent seem to work :) any way i can try
> to
> > debug this (i apologize in advance for my zero lisp knowledge :)
> 
> 
> it actually worked, but only with calling the reset function
> manually
> once.
> 
> try this:
> 
> 
> #+begin_src emacs-lisp
> (defvar tj/last-buffer-tick nil)
> (make-variable-buffer-local 'tj/last-buffer-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)
> 
> (and last-tick (< last-tick curr-tick
> 
> (defun tj/reset-view-mode ()
> (run-with-timer 0 (* 5 60)
> 
> (lambda ()
> (when (tj/new-buffer-ticks-p)
> (view-mode t)
> 
> 
> (add-hook 'org-mode-hook 'tj/reset-view-mode)
> 
> 
> #+end_src
> 
> > On Fri, Jul 18, 2014 at 11:54 AM, Thorsten Jolitz
> 
> > wrote:
> >
> > Xebar Saram  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
> > >  wrote:
> > >
> > > Xebar Saram  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 <
> > > > jorge.a.alf...@gmail.com> wrote:
> > > >
> > > > Xebar Saram  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?

2014-07-18 Thread Xebar Saram
Thx again Thorsten

for some reason it wont work here. i evaluated it and have in in my config.
i open notes in view mode (the other hook i used) and then edit them. i
leave the pc for 5-10 minutes but it dosent revert to view mode for some
reason. am i missing something?

thx!

Z


On Fri, Jul 18, 2014 at 3:35 PM, Thorsten Jolitz  wrote:

> Xebar Saram  writes:
>
> > Thx Thorsten
> >
> > i tried that but that dosent seem to work :) any way i can try to
> > debug this (i apologize in advance for my zero lisp knowledge :)
>
> it actually worked, but only with calling the reset function manually
> once.
>
> try this:
>
> #+begin_src emacs-lisp
> (defvar tj/last-buffer-tick nil)
> (make-variable-buffer-local 'tj/last-buffer-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)
> (and last-tick (< last-tick curr-tick
>
> (defun tj/reset-view-mode ()
>   (run-with-timer 0 (* 5 60)
>   (lambda ()
> (when (tj/new-buffer-ticks-p)
>   (view-mode t)
>
> (add-hook 'org-mode-hook 'tj/reset-view-mode)
> #+end_src
>
> > On Fri, Jul 18, 2014 at 11:54 AM, Thorsten Jolitz 
> > wrote:
> >
> > Xebar Saram  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
> > >  wrote:
> > >
> > > Xebar Saram  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 <
> > > > jorge.a.alf...@gmail.com> wrote:
> > > >
> > > > Xebar Saram  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
> >
> >
> >
> >
>
> --
> cheers,
> Thorsten
>
>
>


Re: [O] a quick way to switch orgmode notes between read-only/editing?

2014-07-18 Thread Thorsten Jolitz
Xebar Saram  writes:

> Thx Thorsten
>
> i tried that but that dosent seem to work :) any way i can try to
> debug this (i apologize in advance for my zero lisp knowledge :)

it actually worked, but only with calling the reset function manually
once. 

try this:

#+begin_src emacs-lisp
(defvar tj/last-buffer-tick nil)
(make-variable-buffer-local 'tj/last-buffer-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)
(and last-tick (< last-tick curr-tick

(defun tj/reset-view-mode ()
  (run-with-timer 0 (* 5 60)
  (lambda ()
(when (tj/new-buffer-ticks-p)
  (view-mode t)

(add-hook 'org-mode-hook 'tj/reset-view-mode)
#+end_src

> On Fri, Jul 18, 2014 at 11:54 AM, Thorsten Jolitz 
> wrote:
>
> Xebar Saram  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
> >  wrote:
> >
> > Xebar Saram  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 <
> > > jorge.a.alf...@gmail.com> wrote:
> > >
> > > Xebar Saram  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
> 
> 
>
>

-- 
cheers,
Thorsten




Re: [O] a quick way to switch orgmode notes between read-only/editing?

2014-07-18 Thread Xebar Saram
Thx Thorsten

i tried that but that dosent seem to work :) any way i can try to debug
this (i apologize in advance for my zero lisp knowledge :)

best

Z


On Fri, Jul 18, 2014 at 11:54 AM, Thorsten Jolitz  wrote:

> Xebar Saram  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
> >  wrote:
> >
> > Xebar Saram  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 <
> > > jorge.a.alf...@gmail.com> wrote:
> > >
> > > Xebar Saram  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?

2014-07-18 Thread Thorsten Jolitz
Xebar Saram  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
>  wrote:
>
> Xebar Saram  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 <
> > jorge.a.alf...@gmail.com> wrote:
> >
> > Xebar Saram  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?

2014-07-18 Thread Xebar Saram
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?

thx alot!

Z


On Fri, Jul 18, 2014 at 2:42 AM, Eric Abrahamsen 
wrote:

> Xebar Saram  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 <
> > jorge.a.alf...@gmail.com> wrote:
> >
> > Xebar Saram  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.
> >
> >
>
>
>


Re: [O] a quick way to switch orgmode notes between read-only/editing?

2014-07-17 Thread Eric Abrahamsen
Xebar Saram  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 <
> jorge.a.alf...@gmail.com> wrote:
>
> Xebar Saram  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.
>
>




Re: [O] a quick way to switch orgmode notes between read-only/editing?

2014-07-17 Thread Xebar Saram
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

best

Z


On Thu, Jul 17, 2014 at 5:46 PM, Jorge A. Alfaro-Murillo <
jorge.a.alf...@gmail.com> wrote:

> Xebar Saram  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.
>
>
>


Re: [O] a quick way to switch orgmode notes between read-only/editing?

2014-07-17 Thread Jorge A. Alfaro-Murillo
Xebar Saram  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.




Re: [O] a quick way to switch orgmode notes between read-only/editing?

2014-07-17 Thread Nick Dokos
Xebar Saram  writes:

> PS. Also can anyone think of a way to get a visual cue when the file
> is in "view mode"?
>
> thx!
>
> Z
>
> On Thu, Jul 17, 2014 at 4:22 PM, Xebar Saram  wrote:
>
>
> can you recommend a way to open all orgmode notes in view mode by
> default, i guess i would then bind a key to disable view mode to
> start editing right?
>

Add a function that enables the minor mode to org-mode-hook (this is a
completely general emacs mechanism and worth understanding thoroughly):

   (add-hook 'org-mode-hook (lambda () (view-mode 1)))

As for visual cues, you get "View" added to the list of modes in the
mode-line.

Nick

 




Re: [O] a quick way to switch orgmode notes between read-only/editing?

2014-07-17 Thread Thorsten Jolitz
Xebar Saram  writes:

> PS. Also can anyone think of a way to get a visual cue when the file
> is in "view mode"?

There is a visual cue in the mode-line:

,
| 1-UUU:**--
`

changes to 

,
| 1-UUU:%%--
`

when view-mode is active

> On Thu, Jul 17, 2014 at 4:22 PM, Xebar Saram 
> wrote:
>
> Thx Thorston this looks great
> 
> 
> can you recommend a way to open all orgmode notes in view mode by
> default, i guess i would then bind a key to disable view mode to
> start editing right?
> 
> 
> thanks alot again
> 
> 
> Z
> 
> 
> 
> 
> 
> On Thu, Jul 17, 2014 at 4:13 PM, Thorsten Jolitz
>  wrote:
> 
> 
> 
> Xebar Saram  writes:
> 
> > hi all
> >
> > 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? i have
> used such
> > options in previous note taking apps that had that option
> build in but
> > i understand that since orgmode notes are just text files
> its a bit
> > more complicated
> >
> > i would love to hear any suggestions on how you guys deal
> with
> > protecting notes/data that still needs to be edited (i do
> use git ofc
> > but i dont always know i screwed my notes :))
> 
> 
> ,[ C-h f view-mode RET ]
> | view-mode is an interactive autoloaded compiled Lisp
> function in
> | `view.el'.
> |
> | (view-mode &optional ARG)
> |
> | Toggle View mode, a minor mode for viewing text but not
> editing it.
> | With a prefix argument ARG, enable View mode if ARG is
> positive,
> | and disable it otherwise. If called from Lisp, enable View
> mode
> | if ARG is omitted or nil.
> |
> | When View mode is enabled, commands that do not change the
> buffer
> | contents are available as usual. Kill commands insert text
> in
> | kill buffers but do not delete. Most other commands beep and
> | tell the user that the buffer is read-only.
> |
> |
> |
> | The following additional commands are provided. Most
> commands
> | take prefix arguments. Page commands default to "page size"
> | lines which is almost a whole window, or number of lines set
> by
> | z or w.
> | Half page commands default to and set "half page size" lines
> | which initially is half a window full. Search commands
> default
> | to a repeat count of one.
> |
> | H, h, ? This message.
> | Digits provide prefix arguments.
> | - negative prefix argument.
> | < move to the beginning of buffer.
> | > move to the end of buffer.
> | o scroll so that buffer end is at last line of window.
> | SPC scroll forward "page size" lines.
> | With prefix scroll forward prefix lines.
> | DEL scroll backward "page size" lines.
> | With prefix scroll backward prefix lines.
> | z like SPC but with prefix sets "page size" to prefix.
> | w like DEL but with prefix sets "page size" to prefix.
> | d scroll forward "half page size" lines. With prefix, sets
> | "half page size" to prefix lines and scrolls forward that
> much.
> | u scroll backward "half page size" lines. With prefix, sets
> | "half page size" to prefix lines and scrolls backward that
> much.
> | RET, LFD scroll forward one line. With prefix scroll forward
> prefix line(s).
> | y scroll backward one line. With prefix scroll backward
> prefix line(s).
> | F revert-buffer if necessary and scroll forward.
> | Use this to view a changing file.
> | = prints the current line number.
> | % goes prefix argument (default 100) percent into buffer.
> | g goes to line given by prefix argument (default first
> line).
> | . set the mark.
> | x exchanges point and mark.
> | @ return to mark and pops mark ring.
> | Mark ring is pushed at start of every successful search and
> when
> | jump to line occurs. The mark is set on jump to buffer start
> or end.
> | m save current position in character register.
> | ' go to position saved in character register.
> | s do forward incremental search.
> | r do reverse incremental search.
> | / searches forward for regular expression, starting after
> current page.
> | ! and @ have a special meaning at the beginning of the
> regexp.
>

Re: [O] a quick way to switch orgmode notes between read-only/editing?

2014-07-17 Thread Thorsten Jolitz
Xebar Saram  writes:

> Thx Thorston this looks great
>
> can you recommend a way to open all orgmode notes in view mode by
> default

you could try (untested!!)

,
| (add-hook 'org-mode-hook 'view-mode)
`

> i guess i would then bind a key to disable view mode to start
> editing right?

That key is 'e' for editing (or 'q' for quitting), already defined in
view-mode. 

I usually open files directly from dired with 'v' instead of 'f' in
view-mode to just have a look, and then either do 'e' or 'q'. 

> On Thu, Jul 17, 2014 at 4:13 PM, Thorsten Jolitz 
> wrote:
>
> 
> Xebar Saram  writes:
> 
> > hi all
> >
> > 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? i have
> used such
> > options in previous note taking apps that had that option build
> in but
> > i understand that since orgmode notes are just text files its a
> bit
> > more complicated
> >
> > i would love to hear any suggestions on how you guys deal with
> > protecting notes/data that still needs to be edited (i do use
> git ofc
> > but i dont always know i screwed my notes :))
> 
> 
> ,[ C-h f view-mode RET ]
> | view-mode is an interactive autoloaded compiled Lisp function in
> | `view.el'.
> |
> | (view-mode &optional ARG)
> |
> | Toggle View mode, a minor mode for viewing text but not editing
> it.
> | With a prefix argument ARG, enable View mode if ARG is positive,
> | and disable it otherwise. If called from Lisp, enable View mode
> | if ARG is omitted or nil.
> |
> | When View mode is enabled, commands that do not change the
> buffer
> | contents are available as usual. Kill commands insert text in
> | kill buffers but do not delete. Most other commands beep and
> | tell the user that the buffer is read-only.
> |
> |
> |
> | The following additional commands are provided. Most commands
> | take prefix arguments. Page commands default to "page size"
> | lines which is almost a whole window, or number of lines set by
> | z or w.
> | Half page commands default to and set "half page size" lines
> | which initially is half a window full. Search commands default
> | to a repeat count of one.
> |
> | H, h, ? This message.
> | Digits provide prefix arguments.
> | - negative prefix argument.
> | < move to the beginning of buffer.
> | > move to the end of buffer.
> | o scroll so that buffer end is at last line of window.
> | SPC scroll forward "page size" lines.
> | With prefix scroll forward prefix lines.
> | DEL scroll backward "page size" lines.
> | With prefix scroll backward prefix lines.
> | z like SPC but with prefix sets "page size" to prefix.
> | w like DEL but with prefix sets "page size" to prefix.
> | d scroll forward "half page size" lines. With prefix, sets
> | "half page size" to prefix lines and scrolls forward that much.
> | u scroll backward "half page size" lines. With prefix, sets
> | "half page size" to prefix lines and scrolls backward that much.
> | RET, LFD scroll forward one line. With prefix scroll forward
> prefix line(s).
> | y scroll backward one line. With prefix scroll backward prefix
> line(s).
> | F revert-buffer if necessary and scroll forward.
> | Use this to view a changing file.
> | = prints the current line number.
> | % goes prefix argument (default 100) percent into buffer.
> | g goes to line given by prefix argument (default first line).
> | . set the mark.
> | x exchanges point and mark.
> | @ return to mark and pops mark ring.
> | Mark ring is pushed at start of every successful search and when
> | jump to line occurs. The mark is set on jump to buffer start or
> end.
> | m save current position in character register.
> | ' go to position saved in character register.
> | s do forward incremental search.
> | r do reverse incremental search.
> | / searches forward for regular expression, starting after
> current page.
> | ! and @ have a special meaning at the beginning of the regexp.
> | ! means search for a line with no match for regexp. @ means
> start
> | search at beginning (end for backward search) of buffer.
> | \ searches backward for regular expression, starting before
> current page.
> | n searches forward for last regular expression.
> | p searches backward for last regular expression.
> | q quit View mode, restoring this window and buffer to previous
> state.
> | q is the normal way to leave view mode.
> | e exit View mode but stay in current buffer. Use this if you
> started
> | viewing a buffer (file) and find out you want to edit i

Re: [O] a quick way to switch orgmode notes between read-only/editing?

2014-07-17 Thread Xebar Saram
PS. Also can anyone think of a way to get a visual cue when the file is in
"view mode"?

thx!

Z


On Thu, Jul 17, 2014 at 4:22 PM, Xebar Saram  wrote:

> Thx Thorston this looks great
>
> can you recommend a way to open all orgmode notes in view mode by default,
> i guess i would then bind a key to disable view mode to start editing right?
>
> thanks alot again
>
> Z
>
>
> On Thu, Jul 17, 2014 at 4:13 PM, Thorsten Jolitz 
> wrote:
>
>> Xebar Saram  writes:
>>
>> > hi all
>> >
>> > 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? i have used such
>> > options in previous note taking apps that had that option build in but
>> > i understand that since orgmode notes are just text files its a bit
>> > more complicated
>> >
>> > i would love to hear any suggestions on how you guys deal with
>> > protecting notes/data that still needs to be edited (i do use git ofc
>> > but i dont always know i screwed my notes :))
>>
>> ,[ C-h f view-mode RET ]
>> | view-mode is an interactive autoloaded compiled Lisp function in
>> | `view.el'.
>> |
>> | (view-mode &optional ARG)
>> |
>> | Toggle View mode, a minor mode for viewing text but not editing it.
>> | With a prefix argument ARG, enable View mode if ARG is positive,
>> | and disable it otherwise.  If called from Lisp, enable View mode
>> | if ARG is omitted or nil.
>> |
>> | When View mode is enabled, commands that do not change the buffer
>> | contents are available as usual.  Kill commands insert text in
>> | kill buffers but do not delete.  Most other commands beep and
>> | tell the user that the buffer is read-only.
>> |
>> |
>> |
>> | The following additional commands are provided.  Most commands
>> | take prefix arguments.  Page commands default to "page size"
>> | lines which is almost a whole window, or number of lines set by
>> | z or w.
>> | Half page commands default to and set "half page size" lines
>> | which initially is half a window full.  Search commands default
>> | to a repeat count of one.
>> |
>> | H, h, ?This message.
>> | Digitsprovide prefix arguments.
>> | - negative prefix argument.
>> | < move to the beginning of buffer.
>> | > move to the end of buffer.
>> | o scroll so that buffer end is at last line of window.
>> | SPC   scroll forward "page size" lines.
>> | With prefix scroll forward prefix lines.
>> | DEL   scroll backward "page size" lines.
>> | With prefix scroll backward prefix lines.
>> | z like  SPC  but with prefix sets "page size" to prefix.
>> | w like  DEL  but with prefix sets "page size" to prefix.
>> | d scroll forward "half page size" lines.  With prefix, sets
>> | "half page size" to prefix lines and scrolls forward that much.
>> | u scroll backward "half page size" lines.  With prefix, sets
>> | "half page size" to prefix lines and scrolls backward that much.
>> | RET, LFD  scroll forward one line.  With prefix scroll forward prefix
>> line(s).
>> | y scroll backward one line.  With prefix scroll backward prefix
>> line(s).
>> | F revert-buffer if necessary and scroll forward.
>> | Use this to view a changing file.
>> | = prints the current line number.
>> | % goes prefix argument (default 100) percent into buffer.
>> | g goes to line given by prefix argument (default first line).
>> | . set the mark.
>> | x exchanges point and mark.
>> | @ return to mark and pops mark ring.
>> | Mark ring is pushed at start of every successful search and when
>> | jump to line occurs.  The mark is set on jump to buffer start
>> or end.
>> | m save current position in character register.
>> | ' go to position saved in character register.
>> | s do forward incremental search.
>> | r do reverse incremental search.
>> | / searches forward for regular expression, starting after current
>> page.
>> | ! and @ have a special meaning at the beginning of the regexp.
>> | ! means search for a line with no match for regexp.  @ means
>> start
>> | search at beginning (end for backward search) of buffer.
>> | \ searches backward for regular expression, starting before current
>> page.
>> | n searches forward for last regular expression.
>> | p searches backward for last regular expression.
>> | q quit View mode, restoring this window and buffer to previous
>> state.
>> | q is the normal way to leave view mode.
>> | e exit View mode but stay in current buffer.  Use this if you
>> started
>> | viewing a buffer (file) and find out you want to edit it.
>> | This command restores the previous read-only status of the
>> buffer.
>> | E exit View mode, and make the current buffer editable
>> | even if it was not editable before entry to View mode.
>> | Q quit View mo

Re: [O] a quick way to switch orgmode notes between read-only/editing?

2014-07-17 Thread Xebar Saram
Thx Thorston this looks great

can you recommend a way to open all orgmode notes in view mode by default,
i guess i would then bind a key to disable view mode to start editing right?

thanks alot again

Z


On Thu, Jul 17, 2014 at 4:13 PM, Thorsten Jolitz  wrote:

> Xebar Saram  writes:
>
> > hi all
> >
> > 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? i have used such
> > options in previous note taking apps that had that option build in but
> > i understand that since orgmode notes are just text files its a bit
> > more complicated
> >
> > i would love to hear any suggestions on how you guys deal with
> > protecting notes/data that still needs to be edited (i do use git ofc
> > but i dont always know i screwed my notes :))
>
> ,[ C-h f view-mode RET ]
> | view-mode is an interactive autoloaded compiled Lisp function in
> | `view.el'.
> |
> | (view-mode &optional ARG)
> |
> | Toggle View mode, a minor mode for viewing text but not editing it.
> | With a prefix argument ARG, enable View mode if ARG is positive,
> | and disable it otherwise.  If called from Lisp, enable View mode
> | if ARG is omitted or nil.
> |
> | When View mode is enabled, commands that do not change the buffer
> | contents are available as usual.  Kill commands insert text in
> | kill buffers but do not delete.  Most other commands beep and
> | tell the user that the buffer is read-only.
> |
> |
> |
> | The following additional commands are provided.  Most commands
> | take prefix arguments.  Page commands default to "page size"
> | lines which is almost a whole window, or number of lines set by
> | z or w.
> | Half page commands default to and set "half page size" lines
> | which initially is half a window full.  Search commands default
> | to a repeat count of one.
> |
> | H, h, ?This message.
> | Digitsprovide prefix arguments.
> | - negative prefix argument.
> | < move to the beginning of buffer.
> | > move to the end of buffer.
> | o scroll so that buffer end is at last line of window.
> | SPC   scroll forward "page size" lines.
> | With prefix scroll forward prefix lines.
> | DEL   scroll backward "page size" lines.
> | With prefix scroll backward prefix lines.
> | z like  SPC  but with prefix sets "page size" to prefix.
> | w like  DEL  but with prefix sets "page size" to prefix.
> | d scroll forward "half page size" lines.  With prefix, sets
> | "half page size" to prefix lines and scrolls forward that much.
> | u scroll backward "half page size" lines.  With prefix, sets
> | "half page size" to prefix lines and scrolls backward that much.
> | RET, LFD  scroll forward one line.  With prefix scroll forward prefix
> line(s).
> | y scroll backward one line.  With prefix scroll backward prefix
> line(s).
> | F revert-buffer if necessary and scroll forward.
> | Use this to view a changing file.
> | = prints the current line number.
> | % goes prefix argument (default 100) percent into buffer.
> | g goes to line given by prefix argument (default first line).
> | . set the mark.
> | x exchanges point and mark.
> | @ return to mark and pops mark ring.
> | Mark ring is pushed at start of every successful search and when
> | jump to line occurs.  The mark is set on jump to buffer start or
> end.
> | m save current position in character register.
> | ' go to position saved in character register.
> | s do forward incremental search.
> | r do reverse incremental search.
> | / searches forward for regular expression, starting after current
> page.
> | ! and @ have a special meaning at the beginning of the regexp.
> | ! means search for a line with no match for regexp.  @ means
> start
> | search at beginning (end for backward search) of buffer.
> | \ searches backward for regular expression, starting before current
> page.
> | n searches forward for last regular expression.
> | p searches backward for last regular expression.
> | q quit View mode, restoring this window and buffer to previous state.
> | q is the normal way to leave view mode.
> | e exit View mode but stay in current buffer.  Use this if you started
> | viewing a buffer (file) and find out you want to edit it.
> | This command restores the previous read-only status of the
> buffer.
> | E exit View mode, and make the current buffer editable
> | even if it was not editable before entry to View mode.
> | Q quit View mode, restoring all windows to previous state.
> | c quit View mode and maybe switch buffers, but don't kill this
> buffer.
> | C quit View mode, kill current buffer and go back to other buffer.
> |
> | The effect of c, q and C depends on how view-mode was entered.  I

Re: [O] a quick way to switch orgmode notes between read-only/editing?

2014-07-17 Thread Thorsten Jolitz
Xebar Saram  writes:

> hi all
>
> 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? i have used such
> options in previous note taking apps that had that option build in but
> i understand that since orgmode notes are just text files its a bit
> more complicated
>
> i would love to hear any suggestions on how you guys deal with
> protecting notes/data that still needs to be edited (i do use git ofc
> but i dont always know i screwed my notes :))

,[ C-h f view-mode RET ]
| view-mode is an interactive autoloaded compiled Lisp function in
| `view.el'.
| 
| (view-mode &optional ARG)
| 
| Toggle View mode, a minor mode for viewing text but not editing it.
| With a prefix argument ARG, enable View mode if ARG is positive,
| and disable it otherwise.  If called from Lisp, enable View mode
| if ARG is omitted or nil.
| 
| When View mode is enabled, commands that do not change the buffer
| contents are available as usual.  Kill commands insert text in
| kill buffers but do not delete.  Most other commands beep and
| tell the user that the buffer is read-only.
| 
| 
| 
| The following additional commands are provided.  Most commands
| take prefix arguments.  Page commands default to "page size"
| lines which is almost a whole window, or number of lines set by
| z or w.
| Half page commands default to and set "half page size" lines
| which initially is half a window full.  Search commands default
| to a repeat count of one.
| 
| H, h, ?This message.
| Digitsprovide prefix arguments.
| - negative prefix argument.
| < move to the beginning of buffer.
| > move to the end of buffer.
| o scroll so that buffer end is at last line of window.
| SPC   scroll forward "page size" lines.
| With prefix scroll forward prefix lines.
| DEL   scroll backward "page size" lines.
| With prefix scroll backward prefix lines.
| z like  SPC  but with prefix sets "page size" to prefix.
| w like  DEL  but with prefix sets "page size" to prefix.
| d scroll forward "half page size" lines.  With prefix, sets
| "half page size" to prefix lines and scrolls forward that much.
| u scroll backward "half page size" lines.  With prefix, sets
| "half page size" to prefix lines and scrolls backward that much.
| RET, LFD  scroll forward one line.  With prefix scroll forward prefix line(s).
| y scroll backward one line.  With prefix scroll backward prefix line(s).
| F revert-buffer if necessary and scroll forward.
| Use this to view a changing file.
| = prints the current line number.
| % goes prefix argument (default 100) percent into buffer.
| g goes to line given by prefix argument (default first line).
| . set the mark.
| x exchanges point and mark.
| @ return to mark and pops mark ring.
| Mark ring is pushed at start of every successful search and when
| jump to line occurs.  The mark is set on jump to buffer start or end.
| m save current position in character register.
| ' go to position saved in character register.
| s do forward incremental search.
| r do reverse incremental search.
| / searches forward for regular expression, starting after current page.
| ! and @ have a special meaning at the beginning of the regexp.
| ! means search for a line with no match for regexp.  @ means start
| search at beginning (end for backward search) of buffer.
| \ searches backward for regular expression, starting before current page.
| n searches forward for last regular expression.
| p searches backward for last regular expression.
| q quit View mode, restoring this window and buffer to previous state.
| q is the normal way to leave view mode.
| e exit View mode but stay in current buffer.  Use this if you started
| viewing a buffer (file) and find out you want to edit it.
| This command restores the previous read-only status of the buffer.
| E exit View mode, and make the current buffer editable
| even if it was not editable before entry to View mode.
| Q quit View mode, restoring all windows to previous state.
| c quit View mode and maybe switch buffers, but don't kill this buffer.
| C quit View mode, kill current buffer and go back to other buffer.
| 
| The effect of c, q and C depends on how view-mode was entered.  If it was
| entered by view-file, view-file-other-window, view-file-other-frame, or
| M-x dired-view-file (M-x view-file, M-x view-file-other-window,
| M-x view-file-other-frame, or the Dired mode v command),
| then q will try to kill the current buffer.
| If view-mode was entered from another buffer, by C-c v,
| M-x view-buffer-other-window, M-x view-buffer-other frame, M-x view-file,
| M-x view-file-other-window, or M-x view-file-other-frame,
| then 

[O] a quick way to switch orgmode notes between read-only/editing?

2014-07-17 Thread Xebar Saram
hi all

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? i have used such
options in previous note taking apps that had that option build in but i
understand that since orgmode notes are just text files its a bit more
complicated

i would love to hear any suggestions on how you guys deal with protecting
notes/data that still needs to be edited (i do use git ofc but i dont
always know i screwed my notes :))

best

Z.