Add information about the fundraising campaign to status buffers
I am trying to make this as unobtrusive while still noticeable as
possible and to make it easy to permanently removed the section.
Some users might consider this to be an annoyance but it is also the
only way that can bring the campaign to the attention of a large
number of users who do not follow me on Twitter are did not visit
Reddit right after the launch.
I also hope that those users who are annoyed by this notice do weight
the brief interruption against the time they have saved by using Magit
and the time it has taken me to make that possible.
The notice will be shown from the 16th September to the end of the
1th October when the campaign ends.
Jonas Bernoulli
6 years ago
69 | 69 | magit-insert-tags-header)) |
70 | 70 | |
71 | 71 | (defcustom magit-status-sections-hook |
72 | '(magit-insert-status-headers | |
72 | '(magit-insert-campaign-header | |
73 | magit-insert-status-headers | |
73 | 74 | magit-insert-merge-log |
74 | 75 | magit-insert-rebase-sequence |
75 | 76 | magit-insert-am-sequence |
473 | 474 | (insert (propertize name 'face 'magit-branch-remote) ?\s) |
474 | 475 | (insert url ?\n)))) |
475 | 476 | |
477 | ;;;; Campaign Header | |
478 | ||
479 | (defvar magit-hide-campaign-header | |
480 | (magit-get-boolean "magit.hideCampaign")) | |
481 | ||
482 | (defun magit-campaign-remove () | |
483 | "Remove the fundraising campaign header permanently." | |
484 | (interactive) | |
485 | (magit-call-git "config" "--global" "magit.hideCampaign" "true") | |
486 | (setq magit-hide-campaign-header t) | |
487 | (magit-refresh)) | |
488 | ||
489 | (defun magit-campaign-hide () | |
490 | "Remove the fundraising campaign header until restart." | |
491 | (interactive) | |
492 | (setq magit-hide-campaign-header t) | |
493 | (magit-refresh)) | |
494 | ||
495 | (defun magit-campaign-visit () | |
496 | "Visit the fundraising campaign in a browser." | |
497 | (interactive) | |
498 | (browse-url "https://www.kickstarter.com/projects/1681258897/its-magit-the-magical-git-client?ref=2nj0oy")) | |
499 | ||
500 | (defvar magit-campaign-section-map | |
501 | (let ((map (make-sparse-keymap))) | |
502 | (define-key map (kbd "C-c C-k") 'magit-campaign-remove) | |
503 | (define-key map (kbd "C-c C-h") 'magit-campaign-hide) | |
504 | (define-key map [remap magit-visit-thing] 'magit-campaign-visit) | |
505 | map)) | |
506 | ||
507 | (defun magit-insert-campaign-header () | |
508 | "Insert a header informing users of the fundraiser." | |
509 | (unless (or (< (float-time) 1505512800) ; 2017-09-16 00:00:00 +0200 | |
510 | (> (float-time) 1506895200) ; 2017-10-02 00:00:00 +0200 | |
511 | magit-hide-campaign-header) | |
512 | (magit-insert-section (campaign nil t) | |
513 | (magit-insert-heading | |
514 | (propertize "<3" 'face '(:foreground "magenta")) | |
515 | (propertize " Please consider backing the Magit fundraiser.") | |
516 | (propertize " Thanks!" 'face '(:foreground "magenta")) | |
517 | " [TAB] to expand" | |
518 | (propertize " <3" 'face '(:foreground "magenta"))) | |
519 | (insert " | |
520 | Please accept my apologies for this brief interruption. | |
521 | ||
522 | C-c C-k remove this section permanently | |
523 | C-c C-h remove this section until restart | |
524 | TAB collapse this section | |
525 | ||
526 | RET visit the fundraising campaign in a browser | |
527 | ||
528 | -------------------------------------------------------------- | |
529 | The magic must go on | |
530 | -------------------------------------------------------------- | |
531 | ||
532 | I am currently running a fundraising campaign on Kickstarter. | |
533 | If it succeeds, then I can work on Magit full-time for a whole | |
534 | year. I am still overflowing with ideas, and depend on your | |
535 | support to realize them. | |
536 | ||
537 | I would love to work on Magit for at least another year and | |
538 | think that its users would miss out on a lot of significant | |
539 | improvements if I were unable to do so. Magit and I are at | |
540 | a crossroad — either I can intensive my efforts or I have | |
541 | to give up bringing the long time goals to completion that | |
542 | I have been working toward for the past few years. | |
543 | ||
544 | Magit is still far from fulfilling its potential and now I | |
545 | need your help to get it there. Visit the campaign to learn | |
546 | more about the planned improvements and please consider to | |
547 | make a contribution. | |
548 | ||
549 | Thank you, | |
550 | Jonas Bernoulli\n\n")))) | |
551 | ||
476 | 552 | ;;;; File Sections |
477 | 553 | |
478 | 554 | (defvar magit-untracked-section-map |