emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Good way to try new org-mode code?
@ 2010-06-30 20:50 Nathan Neff
  2010-06-30 20:55 ` Erik Iverson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Nathan Neff @ 2010-06-30 20:50 UTC (permalink / raw)
  To: emacs-orgmode

I'm using git to track org-mode, and would like to know if there's a way
to switch branches / mess with code in org-mode without having to
run make and make install when I want to test the new code.

Currently, I have org-mode code in my ~/.emacs.d/src/org
directory, and I add this directory to my load-path in my emacs file:

;; Add org-mode to path
(setq load-path (cons "~/.emacs.d/src/org/contrib/lisp" load-path))
(setq load-path (cons "~/.emacs.d/src/org/lisp" load-path))

If I switch branches, or change some code in the above directory,
I don't think the new code is used by emacs unless I run

make clean && make && sudo make install

Is there a way to have emacs read the org-mode source code "on the
fly" without having to run make, make install, etc?

Is there a way to run new code without restarting Emacs?

Thanks,
--Nate

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

* Re: Good way to try new org-mode code?
  2010-06-30 20:50 Good way to try new org-mode code? Nathan Neff
@ 2010-06-30 20:55 ` Erik Iverson
  2010-06-30 21:00 ` Eric Schulte
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Erik Iverson @ 2010-06-30 20:55 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode

<snip>
> 
> Is there a way to have emacs read the org-mode source code "on the
> fly" without having to run make, make install, etc?
> 
> Is there a way to run new code without restarting Emacs?

I think

M-x org-reload

is what you're after.

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

* Re: Good way to try new org-mode code?
  2010-06-30 20:50 Good way to try new org-mode code? Nathan Neff
  2010-06-30 20:55 ` Erik Iverson
@ 2010-06-30 21:00 ` Eric Schulte
  2010-06-30 21:09 ` Sébastien Vauban
  2010-06-30 21:12 ` Bastien
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Schulte @ 2010-06-30 21:00 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode

Hi Nathan,

There are a couple of options here.

If you are only playing around with a couple of functions, or in a
single file, you can interactively evaluate single functions by pressing
C-M-x `eval-defun' with your cursor over the function, similarly you can
interactively evaluate entire files with C-c v `eval-buffer'.  In both
of these cases the interactively evaluated functions will take
precedence over anything loaded on startup, so this is a great way to
experiment with new function definitions.  As a side note, when you want
to debug a function, or closely track it's execution path you can prefix
the `eval-defun' function above (i.e. with C-u C-M-x) which instrument
the function with edebug (the results of which will become clear next
time to use the function).

As for make issues, it is possible to use Org-mode without ever running
make or make install.

I don't know of a way to forcefully reload all of Org-mode, but I find
that evaluation at the function/buffer level is generally sufficient for
my needs.

Best -- Eric

Nathan Neff <nathan.neff@gmail.com> writes:

> I'm using git to track org-mode, and would like to know if there's a way
> to switch branches / mess with code in org-mode without having to
> run make and make install when I want to test the new code.
>
> Currently, I have org-mode code in my ~/.emacs.d/src/org
> directory, and I add this directory to my load-path in my emacs file:
>
> ;; Add org-mode to path
> (setq load-path (cons "~/.emacs.d/src/org/contrib/lisp" load-path))
> (setq load-path (cons "~/.emacs.d/src/org/lisp" load-path))
>
> If I switch branches, or change some code in the above directory,
> I don't think the new code is used by emacs unless I run
>
> make clean && make && sudo make install
>
> Is there a way to have emacs read the org-mode source code "on the
> fly" without having to run make, make install, etc?
>
> Is there a way to run new code without restarting Emacs?
>
> Thanks,
> --Nate
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please 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] 5+ messages in thread

* Re: Good way to try new org-mode code?
  2010-06-30 20:50 Good way to try new org-mode code? Nathan Neff
  2010-06-30 20:55 ` Erik Iverson
  2010-06-30 21:00 ` Eric Schulte
@ 2010-06-30 21:09 ` Sébastien Vauban
  2010-06-30 21:12 ` Bastien
  3 siblings, 0 replies; 5+ messages in thread
From: Sébastien Vauban @ 2010-06-30 21:09 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Nathan,

Nathan Neff wrote:
> I'm using git to track org-mode, and would like to know if there's a way
> to switch branches / mess with code in org-mode without having to
> run make and make install when I want to test the new code.
>
> Currently, I have org-mode code in my ~/.emacs.d/src/org
> directory, and I add this directory to my load-path in my emacs file:
>
> ;; Add org-mode to path
> (setq load-path (cons "~/.emacs.d/src/org/contrib/lisp" load-path))
> (setq load-path (cons "~/.emacs.d/src/org/lisp" load-path))
>
> If I switch branches, or change some code in the above directory,
> I don't think the new code is used by emacs unless I run
>
> make clean && make && sudo make install
>
> Is there a way to have emacs read the org-mode source code "on the
> fly" without having to run make, make install, etc?
>
> Is there a way to run new code without restarting Emacs?

My solution -- since I now want to go deeper in Org (and would like to be able
to code, help, test, patch, etc.) -- would not address your last point (no
restart of Emacs), but is easy to use.

I'm using the following to add subdirectories to the `load-path' variable
(see [¹]):

--8<---------------cut here---------------start------------->8---
(defun my/add-to-load-path (this-directory &optional with-subdirs recursive)
  "Add THIS-DIRECTORY at the beginning of the load-path, if it exists.
Add all its subdirectories not starting with a '.' if the
optional argument WITH-SUBDIRS is not nil.
Do it recursively if the third argument is not nil."
  (when (and this-directory
             (file-directory-p this-directory))
    (let* ((this-directory (expand-file-name this-directory))
           (files (directory-files this-directory t "^[^\\.]")))

      ;; completely canonicalize the directory name (*may not* begin with `~')
      (while (not (string= this-directory (expand-file-name this-directory)))
        (setq this-directory (expand-file-name this-directory)))

      (message "Adding `%s' to load-path..." this-directory)
      (add-to-list 'load-path this-directory)

      (when with-subdirs
        (while files
          (setq dir-or-file (car files))
          (when (file-directory-p dir-or-file)
            (if recursive
                (my/add-to-load-path dir-or-file 'with-subdirs 'recursive)
              (my/add-to-load-path dir-or-file)))
          (setq files (cdr files)))))))
--8<---------------cut here---------------end--------------->8---

and I'm using:

--8<---------------cut here---------------start------------->8---
(defvar local-site-lisp-directory
  (concat (or (getenv "LOCAL_SHARE")
              "~/Downloads") "/emacs/site-lisp/")
  "Name of directory where additional Emacs goodies Lisp files (from the
Internet) reside.")

(my/add-to-load-path local-site-lisp-directory 'with-subdirs 'recursive)
--8<---------------cut here---------------end--------------->8---

to load everything under ~/Downloads/emacs/site-lisp/. Everything but the
directories beginning with a dot.

So, I could have there:

- org-mode-git
- .org-mode-6.35
- .org-mode-6.34

for example. And only the current Git version of org-mode would be loaded at
Emacs startup.

For switching to Org-mode 6.34, just remove the dot in front of the directory
name, add a dot to the current Org directory, and relaunch Emacs.

Note, though, that I'm considering the use of `.el' files only, not byte
compiled ones. But does that make a big difference?

Hope this helps.

Seb

[¹] http://www.mygooglest.com/fni/dot-emacs.html

-- 
Sébastien Vauban


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

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

* Re: Good way to try new org-mode code?
  2010-06-30 20:50 Good way to try new org-mode code? Nathan Neff
                   ` (2 preceding siblings ...)
  2010-06-30 21:09 ` Sébastien Vauban
@ 2010-06-30 21:12 ` Bastien
  3 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2010-06-30 21:12 UTC (permalink / raw)
  To: Nathan Neff; +Cc: emacs-orgmode

Hi Nathan,

Nathan Neff <nathan.neff@gmail.com> writes:

> Is there a way to run new code without restarting Emacs?

I wouldn't use make and make install at all.

Switch to your testing branch and do M-x org-reload RET should do it.

HTH,

-- 
 Bastien

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

end of thread, other threads:[~2010-06-30 21:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-30 20:50 Good way to try new org-mode code? Nathan Neff
2010-06-30 20:55 ` Erik Iverson
2010-06-30 21:00 ` Eric Schulte
2010-06-30 21:09 ` Sébastien Vauban
2010-06-30 21:12 ` Bastien

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).