NewMeansNewPlugin and Custom Field Case Folding

6 views
Skip to first unread message

Chris W

unread,
Sep 18, 2008, 1:06:36 AM9/18/08
to Tiddl...@googlegroups.com
G'day All,

I've seen some discussion about the consistency of case folding of
custom field names and how mixed case names are problematic. The
NewMeansNewPlugin looks for a custom field "isJournal". I have altered
my <<newjournal>> parameters to add this field but custom fields of that
name have a habit of being folded to lowercase. NewMeansNewPlugin
subsequently misses these fields.

Is the best way to have the NewMeansNewPlugin ignore journal entries to
alter it to look for "isjournal" and create journal entries with a lower
case tag?

Chris W

Simon Baird

unread,
Sep 18, 2008, 1:28:16 AM9/18/08
to Tiddl...@googlegroups.com
I've had a quick look at it. isJournal is not a custom field. Rather it is an attribute that is set in createNewTiddlerButton in the core and used to distinguish between new journal and new tiddler buttons. See:
config.macros.newTiddler.createNewTiddlerButton

So I think you've got that mixed up a little. But I'm not understanding what you're trying to do so perhaps there is still a problem. Can you explain it a little more?

Simon.

Chris W

unread,
Sep 18, 2008, 4:17:17 AM9/18/08
to Tiddl...@googlegroups.com
Hi Simon ,

OK. Where this started was with the basic New Journal button in the
side bar (TW2.4.1 + MPTW 2.5.1). Pressing this creates a new journal
entry [[18 September 2008]], tags it "journal", and lets you edit it
etc. Save the journal entry and press the New Journal again and the
NewMeansNewPlugin kicks in giving, by default, a new tiddler "18
September 2008 (1)" attached to the name. I prefer the vanilla TW
behaviour here, but NewMeansNew most other places.

I went looking in the plugin and saw the exception for "isJournal" and
assumed that we were talking a custom field (i.e. XML attribute). I set
the New Journal link up create the entry with this custom field, but
NewMeansNew still added the "(1)".

So, how do I suppress the NewMeansNew behaviour on journal entries?

Eric Shulman

unread,
Sep 18, 2008, 6:26:12 AM9/18/08
to TiddlyWiki
> Save the journal entry and press the New Journal again and the
> NewMeansNewPlugin kicks in giving, by default, a new tiddler "18
> September 2008 (1)" attached to the name.  I prefer the vanilla TW
> behaviour here, but NewMeansNew most other places.

This seems reasonable, given that the journal titles are auto-
generated based on date/time, so there is normally supposed to be only
one journal created per day (unless your journal date format includes
the time as well).

The following very tiny change to the [[NewMeansNewPlugin]] code will
allow it to bypass the title fixup handling for journal titles, while
still applying the fixup logic to all other titles. First, find this
line in the plugin:

title = config.macros.newTiddler.getName(title); // <--- only changed
bit

and then simply add 'else' to the beginning of the line, so it
becomes:

else title = config.macros.newTiddler.getName(title); // <--- only
changed bit

That's it... just an additional five bytes of code and the plugin
behavior will then work as you've suggested.

Note: So, what do you think, Simon? Is this a good tweak to add to the
official NewMeansNewPlugin?

-e
Eric Shulman
TiddlyTools / ELS Design Studios

Simon Baird

unread,
Sep 18, 2008, 7:27:44 AM9/18/08
to Tiddl...@googlegroups.com

Cool. A nice easy change. I've added this to the plugin as a configuration option (but switched off by default since I don't want to change the name to NewMeansNewMostOfTheTimePlugin... :)

So if you put
config.newMeansNewForJournalsToo = false;

in your MptwUserConfigPlugin (or ConfigTweaks or whatever you have) then you will get your desired behaviour.

Changeset here:
http://trac.tiddlywiki.org/changeset/6743


Simon.

--
simon...@gmail.com

Chris W

unread,
Sep 18, 2008, 7:52:36 AM9/18/08
to Tiddl...@googlegroups.com
Simon Baird wrote:

> Cool. A nice easy change. I've added this to the plugin as a configuration
> option (but switched off by default since I don't want to change the name to
> NewMeansNewMostOfTheTimePlugin... :)

Excellent. Thanks guys. I guess NMNMOTTP doesn't roll of the tongue
any better.

Chris W

Reply all
Reply to author
Forward
0 new messages