Unable to change a text property for an org-mode link - emacs

I have the following at the top of an org-mode buffer:
[[aaa][bbb]]
(add-text-properties 1 13 '(help-echo "zzz"))
When I execute the list expression on the second line and hover the mouse of the link, I still get the help echo "LINK: aaa", not the expected "zzz".
UPDATE: I used edebug-trace and found that org-mode runs its code after I run mine and reverts the property back. I will have to use advising function, or, is there another way?

Related

How do I find the meaning of a particular fringe marking in emacs (c mode especially)?

There are various fringe markings that show up in c-mode in emacs (24.4.1). By inference I've figured out that the yellow >> is a warning of some sort, whereas the red >> is an error. But I'd like to be able to know explicitly what the c-mode syntax evaluator thinks is actually the reason why it's marked that line in the fringe. How do I find this out? I've tried clicking on the fringe. Is there some command I can run when placing my cursor on that line?
Fringe marks for any line can be listed with (fringe-marks-at-pos). For more information on that function, see the manual.

New to Emacs. When I type ", \" is automatically inserted

As the title states, I'm relatively new to Emacs. I tried out several starter kits but went with Prelude and changed a lot of things around.
Anyway, I've been getting a good handle on everything...until this morning I was working and I typed double-quotes. Normally Emacs would insert a second double quotes right after ("") due to the auto-completion, but I must have accidentally changed something with a keystroke and now when I type ", I get \"\".
Thoughts?
Thank you.
This seems to be an issue with smartparens which prelude installs by default (see the file prelude-programming.el. This behavior is described in detail on smartparens wiki. To ensure that smartparens is causing problems you can can do C-h k" this would print about the command acutally run when " is pressed, if the command is sp--self-insert-command then the following should work
Paste this (setq sp-autoescape-string-quote nil) to your *scratch* buffer, go to the closing parenthesis and do C-xC-e, this will disable the behavior for current emacs session.
To disable the behavior for all future emacs session, assuming that you are using prelude, you will need to add the following to your personal config (basically some file inside /path/to/prelude/personal/).
(setq sp-autoescape-string-quote nil)
This will disable the auto-escaping of the string quotes, completely. If you like this behavior and do not want to disable it completely you can do what #steckerhalter suggests C-q" will insert just one parenthesis.
If the above does not solve the issue then try providing following info in your question which may help us debug the issue,
1) The list minor modes active (this can be obtained by doing C-hm).
2) Output of C-hk"
Hope that helps
this sounds a lot like smartparens (https://github.com/Fuco1/smartparens) which is included in Prelude. usually when you are inside "" then it will escape the quotes:
"hahah \"\" bah"
if you want to get a normal " inside quotes you have to use C-q " or disable smartparens with M-x smartparens-mode
If, as you say in a comment, " is bound to self-insert-command, then when you type " what happens is that a (single, unescaped) " character is inserted.
However, I suspect you have some mode turned on that does something additional whenever a " char is inserted. You mention automatic insertion of a second ", for example. That kind of behavior comes from a mode such as is provided by library smart-parens or electric-pair.
And you mention Prelude.
To find out what part of your init file (~/.emacs) is causing the behavior you see, bisect your init file recursively (first comment-out half, to see which half is responsible, then 3/4, to see which quarter is responsible,...). Then, if you still have a question about the responsible code, ask here, providing that info.
When you describe your problem here, it is important to be specific: what Emacs version, what mode(s), what libraries have you loaded,... Whatever might be pertinent. But first narrow down the problem by bisecting your init file to find the culprit.

How do I use defjump in emacs lisp to jump to a function in a file?

What I'd like that to do, is when I'm on a line of source such as: foo
And I hit a "jump" key, it should match href="foo.html" and open the file c:/project/root/templates/foo.html.
I've found jump.el (package 'jump' in emacs 24) and am trying to get defjump to work:
(require 'jump)
(defjump
'my-follow-ref
'(("href=\"\\1\"" . "templates/\\1"))
"c:/project/root/"
"Follow a logical link from one part of the source to another.")
My code is based on the example in the help, but I'm getting stuck on a pretty basic emacs lisp error:
mapcar: Wrong type argument: listp, quote
What am I doing wrong?
There is no jump.el in the emacs 24 source tree, and google is no help, but, I guess, your problem is unnecessary quoting: defjump is probably a macro.
Chances are this will work:
(defjump
my-follow-ref
(("href=\"\\1\"" . "templates/\\1"))
"c:/project/root/"
"Follow a logical link from one part of the source to another.")

Display TTY in Emacs Shell mode dirtrack

Is there any way to display the current TTY when using Emacs shell mode? Right now I get around by having tty displayed as part of the prompt but this requires scrolling back
You can display it on the mode line.
Look at the documentation , in elisp manual, section 23.4 -- Mode Line Format. In subsection 23.4.2 there is written how you do it: you write a form that returns the value you are interested about.
`(:eval FORM)'
A list whose first element is the symbol `:eval' says to evaluate
FORM, and use the result as a string to display. Make sure this
evaluation cannot load any files, as doing so could cause infinite
recursion.

Emacs Tpu-edt emulation scrolling margins startup

Can anyone help me get scrolling margins enabled automatically when I start emacs with tpu-edt emulation?
Currently, my _emacs file (WinXP) contains the line:
(setq term-setup-hook 'tpu-edt-on)
I find TPU works great, and I can manually supply the command
M-x tpu-set-scroll-margin
It then prompts me for the top and bottom parameters, and works fine when I supply them.
I tried adding the example line from the tpu-extras.el file into the _emacs file:
(tpu-set-scroll-margins "10%" "15%")
but I get the message:
Symbol's function definition is void: tpu-set-scroll-margin
Help! Scrolling margins are the best feature of all time, and I want them always on!
Aside from the typo question raised by #sanityinc (still open --- you cite the name without s twice and with s once), it's likely that you need to invoke that code when you are in the proper mode. For example, if the mode in question is named tpu-edt-mode, then you do do something like this:
(add-hook 'tpu-edt-mode (lambda () (tpu-set-scroll-margins "10%" "15%")))