Reply to topic  [ 4 posts ] 
Bookmarking through macros 
Author Message

Joined: 2007-04-12 14:59:36
Posts: 201
I am still wondering, in beta 2, that you cannot bookmark the insertion point.

Within a macro you often want to start some process from the insertion point and afterwards get back there. You could do this with the bookmark function, like

Code:
Bookmark as "myStart"
... actual macro
Select bookmark "myStart"
Remove Bookmark


This does not properly work under 3 conditions:
1) if the starting point is just the insertion point rather than an actual selection
2) starting with an non-contiguous selection
3) if the selection is within a text that is already bookmarked. (In spite of giving a clear unambiguous instruction which bookmark you want to delete, you are asked by the program which one it should be: the inner or the outer. I think this is less than perfect.

As to 1) I don't get the Nisus point of view either. What is so difficult to make a selection zero characters wide.
And as to 2) If non-contiguous selections cannot be handled why not consider the first chunk only in this case.
I tried to handle these problems with the new additions to beta 2, (selection insertion and selection length) and it works, but this is unexpectedly slower than with bookmarks.

A last point on the same subject: I think it would be extremely helpful if giving a new bookmark the name of an old bookmark would replace the old by the new. Lets say I work in a long document and I arrive at a point which I bookmark as "I_am_here_now", then a macro doing this could be applied along with the progress of the work.


2007-06-15 00:58:00
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 3682
Location: San Diego, CA
js wrote:
This does not properly work under 3 conditions:
1) if the starting point is just the insertion point rather than an actual selection

Correct, you cannot have an empty bookmark (eg: zero characters). Honestly I don't see any situation where adding, selecting, and finally removing a bookmark would be faster than the following:

Code:
$selStart = Selection Location
$selLength = Selection Length
# do whatever
Set Selection $selStart, $selLength

Bookmarks are much heavier than a few selection reads/writes.

Quote:
3) if the selection is within a text that is already bookmarked. (In spite of giving a clear unambiguous instruction which bookmark you want to delete, you are asked by the program which one it should be: the inner or the outer. I think this is less than perfect.

I will file a feature request that the Remove Bookmark command accept a parameter that specifies the bookmark name.


2007-06-15 12:57:38
Profile WWW

Joined: 2007-01-17 04:01:44
Posts: 151
Post 
I too noticed that you cannot bookmark an insertion point (Nisus Writer Classic could do this). I wanted a macro to use when editing long files. What happens is that frequently I think of something I should check the whole file for, and stop editing to do it. But in a long file it's not easy to find your way back to where you were. So I wrote a macro to do this. Maybe all or part of this will be useful for others, so I'll post it here.

$exists = Select Bookmark “Goback”
if $exists == 0
Find “.”, “Er”
Bookmark As “Goback”
else
Remove Bookmark
Select End
end

This looks for a bookmark called Goback. If not found, it sets a bookmark (I chose the previous character arbitrarily). If found, it deletes the bookmark, and you end up with the cursor back at the original location.


2007-07-04 22:11:48
Profile

Joined: 2007-05-21 08:33:59
Posts: 105
Post 
I've set up a pair of macros to emulate the Quickmark behavior in WordPerfect (previously discussed here: http://www.nisus.com/forum/viewtopic.php?t=2387)

1) Set Quickmark -- consisting of the following two lines:

Find “.”, “Er”
Bookmark As “Quickmark"

2) Goto Quickmark -- consisting of the following two lines:

Select Bookmark “Quickmark”
Scroll to Selection

After trying mountainman's single / toggle macro, I decided I was more comfortable with separate Set and Goto macros.


2007-07-10 19:08:23
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software