How to get clickable text that invokes a functionTrigger a button click with JavaScript on the Enter key in a text boxGetting Emacs to untabify when saving certain file types (and only those file types)How to achieve code folding effects in Emacs?How do I make Git use the editor of my choice for commits?How to create an HTML button that acts like a link?In Emacs, is there a way to Call Interactive Function non-interactively from init.el?order of calling expressions within a defun*Insert text string into ido minibuffer using non-interactive defunEmacs: fill all text except indicated regionsHow can I open a long list of files from within emacs
What do you call a flexible diving platform?
How to apply the changes to my `.zshrc` file after edit?
Use cases for M-0 & C-0?
Why is it considered Acid Rain with pH <5.6
To find islands of 1 and 0 in matrix
3D Statue Park: Daggers and dashes
How to judge a Ph.D. applicant that arrives "out of thin air"
Did the IBM PC use the 8088's NMI line?
Decreasing star count
Why/when is AC-DC-AC conversion superior to direct AC-AC conversion?
Recommendations or Experiences on Archiving Mailing Data
Why force the nose of 737 Max down in the first place?
Why isn't there a serious attempt at creating a third mass-appeal party in the US?
Commercial jet accompanied by small plane near Seattle
What is the most common end of life issue for a car?
If Trump gets impeached, how long would Pence be president?
Examples of simultaneous independent breakthroughs
Help with one interview question --expected length of numbers drawn
Converting 8V AC to 8V DC - bridge rectifier gets very hot while idling
Writing a clean implementation of rock–paper–scissors game in C++
Request for a Latin phrase as motto "God is highest/supreme"
Craving for food?
Why did House of Representatives need to condemn Trumps Tweets?
Why does Canada require mandatory bilingualism in all government posts?
How to get clickable text that invokes a function
Trigger a button click with JavaScript on the Enter key in a text boxGetting Emacs to untabify when saving certain file types (and only those file types)How to achieve code folding effects in Emacs?How do I make Git use the editor of my choice for commits?How to create an HTML button that acts like a link?In Emacs, is there a way to Call Interactive Function non-interactively from init.el?order of calling expressions within a defun*Insert text string into ido minibuffer using non-interactive defunEmacs: fill all text except indicated regionsHow can I open a long list of files from within emacs
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Let's say I have the following text in the buffer
CMM-3: Description
CMM-91: Description 2
I want the CMM-XX to become clickable areas that invoke a custom function
(defun jira-ticket-view (&optional jira-ticket)
"Open Jira Ticket Inside Emacs"
(interactive)
....)
How this can be achieved in emacs/elisp?
button emacs
add a comment |
Let's say I have the following text in the buffer
CMM-3: Description
CMM-91: Description 2
I want the CMM-XX to become clickable areas that invoke a custom function
(defun jira-ticket-view (&optional jira-ticket)
"Open Jira Ticket Inside Emacs"
(interactive)
....)
How this can be achieved in emacs/elisp?
button emacs
Org mode is the first thing that comes to mind; You might consider checking the source for their link handling.
– 0x5453
Mar 26 at 19:03
add a comment |
Let's say I have the following text in the buffer
CMM-3: Description
CMM-91: Description 2
I want the CMM-XX to become clickable areas that invoke a custom function
(defun jira-ticket-view (&optional jira-ticket)
"Open Jira Ticket Inside Emacs"
(interactive)
....)
How this can be achieved in emacs/elisp?
button emacs
Let's say I have the following text in the buffer
CMM-3: Description
CMM-91: Description 2
I want the CMM-XX to become clickable areas that invoke a custom function
(defun jira-ticket-view (&optional jira-ticket)
"Open Jira Ticket Inside Emacs"
(interactive)
....)
How this can be achieved in emacs/elisp?
button emacs
button emacs
edited Mar 27 at 0:20
Drew
24.7k5 gold badges53 silver badges75 bronze badges
24.7k5 gold badges53 silver badges75 bronze badges
asked Mar 26 at 18:37
DmitrySemenovDmitrySemenov
3,6913 gold badges30 silver badges41 bronze badges
3,6913 gold badges30 silver badges41 bronze badges
Org mode is the first thing that comes to mind; You might consider checking the source for their link handling.
– 0x5453
Mar 26 at 19:03
add a comment |
Org mode is the first thing that comes to mind; You might consider checking the source for their link handling.
– 0x5453
Mar 26 at 19:03
Org mode is the first thing that comes to mind; You might consider checking the source for their link handling.
– 0x5453
Mar 26 at 19:03
Org mode is the first thing that comes to mind; You might consider checking the source for their link handling.
– 0x5453
Mar 26 at 19:03
add a comment |
1 Answer
1
active
oldest
votes
Create a new keymap, bind mouse-1
to the function you want to call, and add the keymap to the link text as a text property. Set mouse-face
to highlight
and add help-echo
for extra user-friendliness - those take effect when the user hovers the mouse pointer over the text.
(defun my-function ()
(interactive)
(message "You've clicked the text!"))
(let ((map (make-sparse-keymap)))
(define-key map [mouse-1] 'my-function)
(insert "Foo: "
(propertize "bar" 'keymap map 'mouse-face 'highlight 'help-echo "Click here!")
"n"))
See the section Clickable text in the elisp reference manual for more information.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55364126%2fhow-to-get-clickable-text-that-invokes-a-function%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Create a new keymap, bind mouse-1
to the function you want to call, and add the keymap to the link text as a text property. Set mouse-face
to highlight
and add help-echo
for extra user-friendliness - those take effect when the user hovers the mouse pointer over the text.
(defun my-function ()
(interactive)
(message "You've clicked the text!"))
(let ((map (make-sparse-keymap)))
(define-key map [mouse-1] 'my-function)
(insert "Foo: "
(propertize "bar" 'keymap map 'mouse-face 'highlight 'help-echo "Click here!")
"n"))
See the section Clickable text in the elisp reference manual for more information.
add a comment |
Create a new keymap, bind mouse-1
to the function you want to call, and add the keymap to the link text as a text property. Set mouse-face
to highlight
and add help-echo
for extra user-friendliness - those take effect when the user hovers the mouse pointer over the text.
(defun my-function ()
(interactive)
(message "You've clicked the text!"))
(let ((map (make-sparse-keymap)))
(define-key map [mouse-1] 'my-function)
(insert "Foo: "
(propertize "bar" 'keymap map 'mouse-face 'highlight 'help-echo "Click here!")
"n"))
See the section Clickable text in the elisp reference manual for more information.
add a comment |
Create a new keymap, bind mouse-1
to the function you want to call, and add the keymap to the link text as a text property. Set mouse-face
to highlight
and add help-echo
for extra user-friendliness - those take effect when the user hovers the mouse pointer over the text.
(defun my-function ()
(interactive)
(message "You've clicked the text!"))
(let ((map (make-sparse-keymap)))
(define-key map [mouse-1] 'my-function)
(insert "Foo: "
(propertize "bar" 'keymap map 'mouse-face 'highlight 'help-echo "Click here!")
"n"))
See the section Clickable text in the elisp reference manual for more information.
Create a new keymap, bind mouse-1
to the function you want to call, and add the keymap to the link text as a text property. Set mouse-face
to highlight
and add help-echo
for extra user-friendliness - those take effect when the user hovers the mouse pointer over the text.
(defun my-function ()
(interactive)
(message "You've clicked the text!"))
(let ((map (make-sparse-keymap)))
(define-key map [mouse-1] 'my-function)
(insert "Foo: "
(propertize "bar" 'keymap map 'mouse-face 'highlight 'help-echo "Click here!")
"n"))
See the section Clickable text in the elisp reference manual for more information.
answered Mar 28 at 13:40
legoscialegoscia
30.4k12 gold badges87 silver badges120 bronze badges
30.4k12 gold badges87 silver badges120 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55364126%2fhow-to-get-clickable-text-that-invokes-a-function%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Org mode is the first thing that comes to mind; You might consider checking the source for their link handling.
– 0x5453
Mar 26 at 19:03