customized links in the org mode - emacs

I use org mode to store shortcuts for my projects. Such org files contain mostly links which I create using org-insert-link. But sometimes the simple link is not sufficient so I have to use lisp functions. This works fine but it does not look very nice.
Is there a way to create a link which would call a lisp function?

you can define new "link types" in org-mode with the function org-add-link-type to which you tell what elisp function you want to call for a particular protocol. So, in your case, you could define new protocols for "http-ie" and "load-xml-dirs" and write wrapper functions to process the parameters right. Then you would write your links as normal org links, but with a protocol prefix.
The example from the documentation page is quite straightforward I guess, let me know if it's not enough.

Related

Textmate scopes in custom hover-provider for vscode extension

I've created a custom language extension for my own script language. I've written a tmlanguage file to tokenize my script and do custom highlighting. I created a hover-provider that currently only shows the word that is hovered for testing the provider itself. I want to react on the textmate scopes of the current position in this hover, like the vs code Developer tool "Inspect Editor Token and Scopes" does.
At the end I want to react to one particular scope whose value I want to read and show a corresponding image of this value in the hover.
Fore example a line in my script could look like:
setImage(dic_1/dic_2/testImg)
Now I want to show the image that correlates with the path in the brackets if I hover over it.
I tried to find something in the documentation (https://code.visualstudio.com/api/references/vscode-api#languages) if there is something that would help me but couldn't see anything related.
I tried to ask ChatGPT for help after he suggested "possible internal and not public available methods" it suggested to create a custom hover provider with the help of the library "oniguruma" and tokenize the document again.
However, this feels a bit like an overkill. If vscode has a internal tool that does return the textmate scopes I would guess there is a easy way to access those tokens.
I found this thread (Is there a way to find the textmate scope from within my VSCode extension language functions?) but I don't rally understand why I need to write another parser.
Is there any way to access this textmate scopes in a hover-provider?

How can I add these code completion features my VSCode extension?

I'm in the process of creating a VSCode extension to do code completion for an existing Lua API.
I'm having a bit of trouble achieving the following (examples are JavaScript):
I've been looking for examples and tutorials but haven't come up with much. I assume I may need to do a fair amount of string processing, around the current cursor position, to get enough data to lookup the appropriate documentation (which I stored in an array of json objects). But presently I don't know how to get the meta-data dialog to show when entering parameters.
P.S. I have reviewed the official extension samples.
Your screenshots show two VS Code features:
The first screenshot shows a hover / quick info. It is used to display information about the current word the user is hovering over. To add a hover, your extension should implement and register a HoverProvider
The second screenshot shows parameter hints / signature help. It displays information to the user as they complete a function call. To add signature help, your extension should implement and register a SignatureHelpProvider
In both cases, how you implement the functionality is entirely up to your extension. Most language extensions maintain a structural representation of the file (such as an AST) and use this to provide hover and signature help info.
You can also either implement your extension as a direct VS Code extension or using the language server protocol (which works across editors). See VS Code's Language Extensions Overview for more information about developing a language extension and why you may want to consider the Language Server Protocol

Confluence Macro: How to include content

There are these two macros available in Confluence: Excerpt Macro and Excerpt Include Macro, but these are somewhat limited.
I created my own User Macro to extend the existing Excerpt Macro in a way that I can add some parameters to the excerpt, like ID, etc.
I am also able to get the content from my macro via the REST api in my code, which is cool.
BUT, I am unable to find a way to get the content and include it into another page via another macro.
In other words, I am trying to figure out a way to create my own User Macro to extend the existing Excerpt Include Macro.
Is there a way to see the Template content for these existing Confluence Macros, or is there a way to have a User Macro include some content from some other page?
This is not your exact answer, but there is a plug-in multiexcerpt which probably does exactly what you are looking for.

Notepad++ Auto-Complete

I am looking to see if anyone can guide me to constructing an Auto-Complete XML plugin for Lua. I know all about the LOVE thing, but I have no idea how to set it up so it supports metatables too.
For example
local npc = Npc(getNpcCid()) -- This creates an instance of Npc metatable
npc:getName()
Does anyone know how I can make it so it shows a list of all methods in the Npc() metatable when I type "npc:"?
Check out this YouTube video: http://www.youtube.com/watch?v=muJvM-Hz6w4
The person that made that video is showing that something like this is possible, but I don't know how to make that possible in the XML plugin.
afaik np++ is not able to search and parse the class outline of separated files. So custom class methods are not able to be detected.
It's auto-complete setting is only for pre-defined static functions only.

Xcode/iPhone Code templates

Is there some tool in Xcode that allows me to store snippets of code I often reuse in various applications so I do not have to retype it each time? I am talking about things like all the code that goes into defining Table Delegate Methods and Table Source Methods, UIAlertViews code and such. I just would like to have my own private repository where I can put snippets of code I think I may need in the future in other apps. Is there anything like that? Thanks for any help.
I guess the answer to your need is discussed in this page http://www.turkeysheartrhinos.com/?p=8. Look at the "Custom TextMate – Like Macros" section.
In Interface Builder you can drag and drop components you've built into the library under the Custom Objects list. These can be reused in other XIBs you build later.
I'm not sure about code snippets in Xcode itself, I would find that useful too. If you are talking reuse though, can you put alot of your generic stuff in superclasses that you can inherit from when appropriate?
Try "Edit User Scripts..." under the script menu in Xcode. Look at the scripts under the "HeaderDoc" header to see some examples of inserting templates into code. You'll have to reformat your snippets into blocks of Perl like these, but this approach also gives you those neat tab-through-able input areas like you see when you autocomplete method calls.
How about using the tool "sinppets" ?