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;








1















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?










share|improve this question
























  • 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

















1















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?










share|improve this question
























  • 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













1












1








1








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?










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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












1 Answer
1






active

oldest

votes


















5














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.






share|improve this answer






















    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
    );



    );













    draft saved

    draft discarded


















    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









    5














    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.






    share|improve this answer



























      5














      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.






      share|improve this answer

























        5












        5








        5







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 28 at 13:40









        legoscialegoscia

        30.4k12 gold badges87 silver badges120 bronze badges




        30.4k12 gold badges87 silver badges120 bronze badges
















            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.



















            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현