#32 re-reading of template files

open
nobody
None
3
2007-02-27
2006-10-10
Richard Harris
No

Geany is 90% elegant and 10% brain-damaged. How could
you hard-code the templates? And how could you not
dynamically scan the template dir for new ones? How
can you be so right about everything else and so wrong
about this?

Get the templates out of the code and just stick the
files in the installation. Then use whatever is there.

Discussion

  • Nick Treleaven
    Nick Treleaven
    2006-10-10

    • status: open --> closed
     
  • Richard Harris
    Richard Harris
    2006-10-10

    Logged In: YES
    user_id=1616186

    Nick,

    You are hallucinating. Or worse. Try reading your own
    file: "templates.c".
    Or try deleting template.filetype.ruby and see if it
    will stay deleted. Or try creating and using a
    template.filetype.python.

    Please, take the templates out of the code and dynamically
    pull in the files in ~/.geany

     
  • Richard Harris
    Richard Harris
    2006-10-10

    • status: closed --> open
     
  • Nick Treleaven
    Nick Treleaven
    2006-10-10

    Logged In: YES
    user_id=1268692

    I have read templates.c. I don't know why you would want to
    delete template.filetype.ruby.
    At the moment there is some redundancy - this is so that the
    correct file, e.g. template.filetype.ruby already exists,
    and the user just needs to edit it to their needs. If it
    doesn't exist, it is created from a default in templates.c.
    I have just confirmed that editing the Ruby template works
    fine, after restarting Geany.

    There are not templates for every filetype yet.

    Do you want ~/.geany/template.* to be checked every time
    before a template is inserted? This seems like overkill.

     
  • Nick Treleaven
    Nick Treleaven
    2006-10-10

    • summary: templates shouldn't be hard-coded --> templates for more filetypes & template re-reading
     
  • Richard Harris
    Richard Harris
    2006-10-10

    Logged In: YES
    user_id=1616186

    I have read templates.c. I don't know why you would
    want to delete template.filetype.ruby.

    Maybe a user would want to delete everything
    she didn't use.

    At the moment there is some redundancy - this is so
    that the correct file, e.g. template.filetype.ruby
    already exists, and the user just needs to edit it
    to their needs. If it doesn't exist, it is created
    from a default in templates.c. I have just
    confirmed that editing the Ruby template works
    fine, after restarting Geany.

    Yes. The little things work. The big, general
    template thing does not.

    There are not templates for every filetype yet.

    If you pulled them dynamically, there would be --because we
    users would simply make what we needed.

    Do you want ~/.geany/template.* to be checked every
    time before a template is inserted? This seems like
    overkill.

    Yes. It would be _normal_, not overkill, to parse that
    directory everytime the menu-item is activated. Unless
    of course you are paying for computer time by the cycle.
    My processor runs for free.

     
  • Enrico Tröger
    Enrico Tröger
    2006-10-10

    • status: open --> closed
     
  • Enrico Tröger
    Enrico Tröger
    2006-10-10

    Logged In: YES
    user_id=1117045

    Hey Richard,

    at anytime perhaps we will implement some kind of dynamic
    template detection. But at the moment other things have
    priority.

    Searching for new filetype templates every time the menu is
    activated is definitely overkill. Not because of CPU cycles
    but because of hard disk accesses.
    If you want to have more templates in Geany, just send us a
    template and we will include it.

    For further discussion, I would suggest we move this to the
    mailing list. (For information about the mailing list and
    how to join, please visit Geany's homepage.)

     
  • Richard Harris
    Richard Harris
    2006-10-11

    Logged In: YES
    user_id=1616186

    at anytime perhaps we will implement some kind of
    dynamic
    template detection. But at the moment other things
    have
    priority.

    I can understand that. But keep in mind that once you
    make your templates dynamic and get them out of the
    code, your code will be considerably smaller and more
    easily maintained, which will free you up for those other
    things.

    Searching for new filetype templates every time the
    menu is
    activated is definitely overkill. Not because of CPU
    cycles
    but because of hard disk accesses.

    How old a hardrive are you using? How often
    do you think users hit the menu? Bis du doof?

    If you want to have more templates in Geany, just
    send us a
    template and we will include it.

    Before I do, let me see if I understand your offer.
    Any time a user needs a new template, you will hardcode
    it into geany for them? And how fast is the turnaround
    time? Can I get my new build with the template that same
    day,
    next day, two weeks ...?

    For further discussion, I would suggest we move this
    to the
    mailing list. (For information about the mailing list
    and
    how to join, please visit Geany's homepage.)

    I don't need any more email, thanks. Lists are for
    insiders, those who are already users. SF forums
    are for the community, to keep things like this public.

    Please keep in mind that I am only dogging you on this
    because
    otherwise geany is better than 90% of what is out there. It
    is faster and cleaner than PyPE, SPE, UliPAD, Dr Python, and
    that is just the python IDEs I tested it against.

    Not handling all templates dynamically will discourage
    almost
    all experienced programmers from geany. Because almost all
    serious programming environments, commercial and GPL'd, do
    it dynamically.

    'Nuff said.

     
  • Richard Harris
    Richard Harris
    2006-10-11

    • status: closed --> open
     
  • Enrico Tröger
    Enrico Tröger
    2006-10-11

    Logged In: YES
    user_id=1117045

    "Bis du doof?" -> Nein, bin ich nicht.
    Again, we probably will do this. But not today and tomorrow.

    Nick and me are willing to help you and of course, we also
    want to make Geany better. And we want to discuss things and
    reach a solution. But not in the way you do. Sorry, but you
    should be aware that we provide some piece of software to
    you and you *can* use it or not. You don't have any state to
    demand anything. You can ask for something and if you do
    this in the right way(e.g. by not offending developers) it
    works.
    We have a real life and nobody is sponsoring us for the work
    on Geany. Please keep this in mind.
    Discussing things in this way wastes time which can be used
    for improving Geany.

     
  • Nick Treleaven
    Nick Treleaven
    2007-02-27

    Logged In: YES
    user_id=1268692
    Originator: NO

    There is now filetype template support for all filetypes in SVN.
    Creating ~/.geany/templates/filetype.python will now add a new template menu item when Geany is next started.
    Note that template file paths have changed - they're now in a templates directory in ~/.geany.

     
  • Nick Treleaven
    Nick Treleaven
    2007-02-27

    • priority: 5 --> 3
    • summary: templates for more filetypes & template re-reading --> re-reading of template files
     
  • Logged In: YES
    user_id=622019
    Originator: NO

    Any chance of having the possibility of adding any kind of template, which might or might not be coupled with filetypes? Right now I'm working on a perl project where I would like to have templates for modules, scripts, docs, tests etc. Simply using something like: .geany/templates/foo (to appear in insert comment) or .geany/templates/filetype.foo and add afoo entry in filetypes.conf didn't do the trick.

    It would be highly appreciated.

    If needed feel free to point me at the related code to possibly provide a patch for you. keep up the good work.

     
  • Enrico Tröger
    Enrico Tröger
    2007-12-12

    Logged In: YES
    user_id=1117045
    Originator: NO

    This is not possible at the moment. Maybe we will add something like this sometime.

    As a (ugly) workaround you could use snippets to define own templates. Read the manual about snippets and see the snippets.conf. But this would be quite ugly because you had to write your templates each in one line ;-(.

     
  • Logged In: NO

    Yeah I looked at the source code yesterday and it indeed seems quite hardcoded as someone mentioned. Some system for adding a

    [templates]
    [functions]
    "D(msg) function": debug_function.c
    [comments]
    "GPL notice": gpl.txt
    [startup]
    "Some random template": random
    "My favourite python format": default.py

    which reads that from default dirs and in turn adds it to menus might be sensible, and more versatile. Would there be any interest in that you think? Or maybe something else is planned. Or maybe it doesn't make sense at all?

     
  • Enrico Tröger
    Enrico Tröger
    2007-12-12

    Logged In: YES
    user_id=1117045
    Originator: NO

    Hmm, what you mention fits more in a new plugin than directly in Geany, IMO.
    So, if you want to write a plugin to offer this, feel free to do it.

    Another (simpler) idea could be:
    Extend the current code which reads filetype.* as filetype templates, so it reads filetype.templatename.*, e.g.
    filetype.module.perl, filetype.doc.perl and so on and then add these types with the templatename as menu item to the New from template menu item. Would be quite easy to add and would offer you what you need.
    Anyway, I like the idea of a plugin a bit more so there are more, flexible actions possible.

     
  • Logged In: NO

    Ok, I need to read up on how to make plugins. Still haven't got them to work, thanks.

     
  • Nick Treleaven
    Nick Treleaven
    2008-05-14

    Logged In: YES
    user_id=1268692
    Originator: NO

    @nobody:
    Custom template file support is now in Geany SVN, and re-reads the files when the menu item is clicked:
    http://geany.uvena.de/manual/dev/index.html#custom-file-templates

    Perhaps something similar could be done for the other templates.