Collision with two lines of code makes code does not work the way it is meant by me(?) - autohotkey

Try running the following code yourself, and you would notice that "/hello" changes to "/HELLO", but I want it to change it to "hi". On the other hand, I want to keep the 1.st line of code, which changes "hello" to "HELLO". How could I achieve this(?)
This code problem is very related to my last problem:
Collision with two lines of code make code does not work the way it is meant by me, what could I do different to get this work(?)
The soltuion for my last problem was good for that problem, but it is not working for the new above mentioned problem.
::hello::HELLO
::/hello::hi

That is interesting. I really expected it to work by removing / from the EndChars. But after looking at it for a while, it becomes obvious why it's behaving this way. When you type "/hello" it actually matches to both hotstrings, so AHK chooses the first one defined. Anyway, there are two solutions that I know of:
Reorder your hotstrings. Place ::/hello::hi above the other one and you'll always get the desired result. Additionally, you don't need to change the EndChars since / is the first character.
Use the asterisk option on the second hotstring. This will make it update immediately, which may or may not be desirable (I prefer it).

Related

CLUTO doc2mat specified stop word list not working

I am trying to convert my documents into vector-space format using doc2mat
On the website, it says I can use my specified text file where words are white-space separated or on multiple lines. So, I use some code similar to this one:
./doc2mat -mystoplist=stopword.txt -skipnumeric mydocuments.txt myvectorspace.txt
However, when I check the output .clabel file, it still has stop words that's in stopword.txt.
I really do not know how to do this. Someone help me out please? Thank you!
There's one important thing I should remember: I should include ALL the unwanted words in my stop list. This is somewhat difficult since there's always some variations available...
For example, if I want to exclude method I add it to my list. However, the resulting vocabulary may also contain method since there are words like methodist, methods, etc. Then doc2mat by default stems these words and I will still get method in the output.
Another thing is to make sure that "-nostop" option must be provided for user-specified stop list.

emacs Dired find previous match

I mark up a bunch of files in dired
then hit A to search through them for a reg-exp
from there its M-, to move through to the next match
how do I move back though to the last match?
i.e. whats the opposite of M-, in this instance
I know you can do this but I cannot find anything in the documentation anywhere
I don't think dired/tags will do that as is.
The function you're invoking with M-,is tags-loop-continue,which appears to be wired to ultimately use re-search-forwardonly. These two functions are defined in etags.el if you want to take a look, but there doesn't seem to be anything like atags-loop-gobackfunction or equivalent.
However, Icicles can apparently do what you want, as indicated in this discussion of a question identical to yours, on the gnu-emacs-help mailing list.

How can I keep footnotes together with message text when top-posting?

I want better control of the footnote positioning within an email message. I could write the code to modify footnote-mode to do what I want, but first I want to see if somebody else has already solved this problem.
When I am top-posting with message-mode and add an entry with footnote-mode the footnotes go to the end of the buffer, but instead I want it to come before the previous message citation which starts out with something like:
Elvis Presley <the.king#graceland.com> writes:
If I have a signature automatically added based on footnote-signature-separator then the footnotes get positioned before the signature, however in email I don't use a signature. And furthermore, when I use a closing like:
-Elvis
or
Thanks,
Elvis
then I usually want to footnotes to come after that closing.
What I would like is to have the best optimal position detected automatically whether I am top-posting or in-line posting. I expect the best solution will be to use text-properties-at to detect gnus-cite-* lines and maybe to define text properties for the footnotes section. And/or maybe overlays?
Also note that suggestions like the following will not work:
(setq footnote-signature-separator "^-- $\\|#.*writes:")
Not only is that overly simplistic for the kind of positioning control I would like, but it also simply does not work correctly.

CDT compare broken?

Help. I have been relying on the compare editor for code review, and it mostly works quite well.
But for some reason, on some files, it is giving me inconsistent results and telling me that some code is different when it is not. It can't seem to deal with commented out code in this file.
It tells me that later functions are different and tries to match lines in those functions.
I have also found cases where it simply thinks the code is different but it is not.
It then decides that there must be changes in hundreds of lines below this.
I am able to work around by remove the code with #if 0, #endif, but it is not pretty.
Has anyone else seen this and do you know of any way to fix it?
I am trying to get a clean diff do I can see just the actual changes between the files.
It is driving me to drink - and it is still early in the day!

Using regexp to index a file for imenu, performance is unacceptable

I'm producing a function for imenu-create-index-function, to index a source code module, for csharp-mode.el
It works, but delivers completely unacceptable performance. Any tips for fixing this?
The Background
I looked at js.el, which is the rebadged "espresso" now included, since v23.2, into emacs. It indexes Javascript files very nicely, does a good job with anonymous functions and various coding styles and patterns in common use. For example, in javascript one can do:
(function() {
var x = ... ;
function foo() {
if (x == 1) ...
}
})();
...to define a scope where x is "private" or inaccessible from other code. This gets indexed nicely by js.el, using regexps, and it indexes the inner functions (anonymous or not) within that scope also. It works quickly. A big module can be indexed in less than a second.
I tried following a similar approach in csharp-mode, but it's quite a bit more complicated. In Js, everything that gets indexed is a function. So the starting regex is "function" with some elaboration on either end. Once an occurrence of the function keyword is found, then there are 4 - 8 other regexps that get tried via looking-at - the number depends on settings. One nice thing about js mode is that you can turn on or off regexps for various coding styles, to speed things along I suppose. The default "styles" work for most of the code I tried.
This doesn't work in csharp-mode. It works, but it performs poorly enough to make it not very usable. I think the reason for this is that
there is no single marker keyword in C#, as function behaves in javascript. In C# I need to look for namespace, class, struct, interface, enum, and so on.
there's a great deal of flexibility with which csharp constructs can be defined. As one example, a class can define base classes as well as implemented interfaces. Another example: The return type for a method isn't a simple word-like string, but can be something messy like Dictionary<String, List<String>> . The index routine needs to handle all those cases, and capture the matches. This makes it run sloooooowly.
I use a lot of looking-back. The marker I use in the current approach is the open curly brace. Once I find one of those, I use looking-back to determine if the curly is a class, interface, enum, method, etc. I read that looking-back can be slow; I'm not clear on how much slower it is than, say, looking-at.
once I find an open-close pair of curlies, I call narrow-to-region in order to index what's inside. not sure if this is will kill performance or not. I suspect that it is not the main culprit, because the perf problems I see happen in modules with one namespace and 2 or 3 classes, which means narrow gets called 3 or 4 times total.
What's the Question?
My question is: do you have any tips for speeding up imenu-like indexing in a C# buffer?
I'm considering:
avoiding looking-back. I don't know exactly how to do this because when re-search-forward finds, say, the keyword class, the cursor is already in the middle of a class declaration. looking-back seems essential.
instead of using open-curly as the marker, use the keywords like enum, interface, namespace, class
avoid narrow-to-region
any hard advice? Further suggestions?
Something I've tried and I'm not really enthused about re-visiting: building a wisent-based parser for C#, and relying on semantic to do the indexing. I found semantic to be very very very (etc) difficult to use, hard to discover, and problematic. I had semantic working for a while, but then upgraded to v23.2, and it broke, and I never could get it working again. Simple things - like indexing the namespace keyword - took a very long time to solve. I'm very dissatisfied with it and don't want to try again.
I don't really know C# syntax, and without looking at your elisp it's hard to give an answer, but here goes anyway.
looking-back can be deadly slow. It's the first thing I'd experiment with. One thing that helps a lot is using the limit arg to, say, restrict your search to the beginning of the current line. A different approach is when you hit the open curly do backward-char then backward-sexp (or whatever) to get to the front of the previous word, then use looking-at.
Using keywords to search around instead of open curly is probably what I would have done. Maybe something like (re-search-forward "\\(enum\\|interface\\|namespace\\|class\\)[ \t\n]*{" nil t) then using match-string-no-properties on the first capture group to see which of the keywords was found. This might help with the looking-back problem as well.
I don't know how expensive narrow-to-region is, but could be avoided by when you find a open curly do save-excursion forward-sexp and keep point as a limit for the current iteration of your (I assume recursive) searches.