emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] combine orgmode and file system browsing


From: Sebastian Rose
Subject: Re: [Orgmode] combine orgmode and file system browsing
Date: Mon, 23 Mar 2009 12:59:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux)

Andreas Burtzlaff <address@hidden> writes:
> The script does not generate the backlinks only the file system
> structure, so it's not really useful, sorry.
> It would make more sense to implement that properly as a major-mode and
> make each directory update its state from the filesystem and the org file 
> whenever it
> becomes visible than to have to manually recreate the static representation
> everytime the filesystem's structure or the org file's content changes.


I know, but still. I have lot's of small to medium projects here and an
Org-mode file for each project. All ressources are listed in the
Org-file.

To have the filetree in there is a good way to jump the source file in
question and remember the code's structure easily a few weeks/months
later.


  * Customer calls
  * `C-,' until I see the Org-file
  * M-RET to record the BUG/feature request
  * Jump to file in question easily.


Another nice thing about it is, that the tree shows up in speedbar too.



Maybe the idea could make a nice contribution too? `C-c C-c' to update
the tree or include it dynamically. :)



I modified the script a bit to exclude some files and directories:


#!/bin/bash

DIR=$1


# Define sufixes for directory names, that shouldn't be moved to the server:
declare -a exclude_dirs
exclude_dirs=('RCS' 'CVS' '.git' '_MTN' '.hg')

# define suffixes for files, that should not be moved to the server:
declare -a exclude_files
exclude_files=('.jpg' '.png' '.gif')



# This checks wether we have to run for this directory
function exclude_directory ()
{
    for suf in address@hidden ; do
        is_excluded=${1%$suf}
        if [ "$is_excluded" != "$1" ] ; then
            return 0
        fi
    done
    return 1
}


# This checks wether we have to run for this file
function exclude_file ()
{
    for suf in address@hidden
      do
      is_excluded=${1%$suf}

      if [ "$is_excluded" != "$1" ] ; then
          return 0
      fi
    done
    return 1
}



function toOrgRec {
    local BUFFER=""
    for d in $( echo "$(find $1 -maxdepth 1 -type d )" | tail -n +2 ); do

         if ! exclude_directory "$d"; then
            BUFFER="${BUFFER}
* [[file:${d}][$(basename ${d})]]"
            toOrgRec ${d}
            BUFFER=${BUFFER}$( echo "${RETURN_BUFFER}" | sed "s/^\*/**/" | sed 
"s/^ /  /" )
        fi
    done

    for f in $(find $1 -maxdepth 1 -not -type d); do
        if ! exclude_file "${f}"; then
            BUFFER="${BUFFER}
* [[file:${f}][$(basename "${f}" )]]"
        fi
    done

    RETURN_BUFFER=${BUFFER}
}

toOrgRec ${DIR}
echo "$( echo "${RETURN_BUFFER}" | tail -n +2 )"

</#part>


--
Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover
Tel.:  +49 (0)511 - 36 58 472
Fax:   +49 (0)1805 - 233633 - 11044
mobil: +49 (0)173 - 83 93 417
Http:  www.emma-stil.de

reply via email to

[Prev in Thread] Current Thread [Next in Thread]