1 ;;; xetla-tips.el --- "Tip of the day" feature for XEtla.
3 ;; Copyright (C) 2004 Free Software Foundation, Inc. (GPL)
4 ;; Copyright (C) 2004 Steve Youngs (BSD)
6 ;; Author: Steve Youngs <steve@eicq.org>
7 ;; Maintainer: Steve Youngs <steve@eicq.org>
9 ;; Keywords: arch archive tla
11 ;; Based on xtla-tips.el by: Matthieu Moy <Matthieu.Moy@imag.fr>
13 ;; This file is part of XEtla.
15 ;; Redistribution and use in source and binary forms, with or without
16 ;; modification, are permitted provided that the following conditions
19 ;; 1. Redistributions of source code must retain the above copyright
20 ;; notice, this list of conditions and the following disclaimer.
22 ;; 2. Redistributions in binary form must reproduce the above copyright
23 ;; notice, this list of conditions and the following disclaimer in the
24 ;; documentation and/or other materials provided with the distribution.
26 ;; 3. Neither the name of the author nor the names of any contributors
27 ;; may be used to endorse or promote products derived from this
28 ;; software without specific prior written permission.
30 ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
31 ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32 ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33 ;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
34 ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
37 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
39 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
40 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 ;; To raise the learning curve for xetla.el users. Some commands can
46 ;; (optionaly) pop-up a buffer with a tip. Currently, `xetla-commit'
56 (defconst xetla-tips-array
58 "Welcome to XEtla. I'm the tip buffer. I will appear from time to time
59 to show you interesting features that you may have missed! Disable me
60 by setting the variable `xetla-tips-enabled' to nil.
62 Press `q' to exit, `n' to view next tip, `p' to view previous tip."
63 "For the available xetla commands Xetla provides a corresponding interactive
67 M-x xetla-inventory ... runs tla inventory
68 M-x xetla-undo ... runs tla undo
69 M-x xetla-changes ... runs tla changes
71 XEtla prompts for the needed parameters."
72 "Most interesting commands are available through a global keyboard
73 shortcut. Try `C-x T C-h' to get a list"
74 "XEtla provides several major modes for different buffers. Each mode
75 has its own keybindings. Get help with `\\[describe-mode]'"
76 "When XEtla is loaded, `C-M-h' in a minibuffer prompt gives you help
77 about the command being run."
78 "When you are prompted for an archive, category, branch, version or
79 revision name, lots of keybindings are available. Get a list with `C-h'."
80 "XEtla allows you to manage a list of bookmarks. Try `\\[xetla-bookmarks]' and add
81 bookmarks from the menu. You may also add bookmarks from an archives,
82 category, version or revision buffer as well as from the xetla-browse
84 "From the bookmark buffer, you can select some bookmarks and make
85 them partners with \\<xetla-bookmarks-mode-map>`\\[xetla-bookmarks-marked-are-partners]'. Afterwards, pressing `\\[xetla-bookmarks-missing]' on a bookmark will
86 show you the missing patches from his partners."
87 "You can add changelog style comments to your commit log by `\\[xetla-add-log-entry]'."
88 "You can enable ispell, flyspell or other useful mode for editing
89 log files by `M-x customize-variable RET xetla-log-edit-mode-hook RET'."
90 "By default, XEtla caches any log file you retrieve with
91 `xetla-cat-log' or `xetla-cat-archive-log' in ~/.arch-log-library. This
92 speeds up many XEtla operations.
94 You can disable this by setting `xetla-log-library-greedy' to nil."
95 "XEtla is highly customizable.
96 Start it by `M-x customize-group RET xetla RET'."
97 "In an *xetla-changes* buffer you can quickly jump to the source file by
98 `RET', or view the source file in another window by `v', or start
99 an ediff session by `e' to inspect/reject parts of the changes."
100 "In a *xetla-changes* buffer, you can quickly jump from the list of
101 files to the corresponding patch hunk, and come back with `j'"
102 "After committing, you can review the last committed patch with
103 `M-x xetla-changes-last-revision RET'.
105 Usefull to review and fix a patch you've just merged without mixing
106 manual modifications and merge in the same patch."
107 "After a merge, typing \\<xetla-log-edit-mode-map> `\\[xetla-log-edit-insert-log-for-merge-and-headers]' in the log buffer will generate
108 for you a summary line, keyword and body. This is highly
110 "Report bugs using `M-x xetla-submit-bug-report RET'"
111 "You've got a nice, graphical, archive browser one
112 `M-x xetla-browse RET' away."
113 "In the bookmark buffer, pressing\\<xetla-bookmarks-mode-map> `\\[xetla-bookmarks-find-file] starts with the local
114 tree of the bookmark at point for the default directory."
115 "`\\[xetla-file-ediff]' in a source file will open an ediff session with the
116 unmodified version of the file. From here, you can undo patch hunks
117 one by one with the key `b'"
118 "In the *tree-lint* buffer, with your cursor on a message, most
119 commands will apply to all the files listed under this message."
120 "Many XEtla commands accept one or more prefix arguments. For example,
121 from the *xetla-log-edit* buffer:
122 \\<xetla-log-edit-mode-map>
123 `\\[xetla-log-edit-done]' -- Save and kill the log buffer
124 `\\[universal-argument] \\[xetla-log-edit-done]' -- Save and kill the log, plus commit the changes
125 `\\[universal-argument] \\[universal-argument] \\[xetla-log-edit-done]' -- Save and kill the log, plus commit and \"seal\"
126 `\\[universal-argument] \\[universal-argument] \\[universal-argument] \\[xetla-log-edit-done]' -- Save and kill the log, plus commit and \"fix\"
128 All of the XEtla commands that accept prefix arguments are documented,
129 so use `\\[describe-function] xetla-[command] RET' to see more nifty
131 "Give a prefix argument to M-x xetla-changelog and you'll be prompted
132 for a version to display a ChangeLog for. This is handy if you want to
133 see a ChangeLog for a previous version of a project."
134 "In a *xetla-changes* buffer, hit RET with point somewhere in the diff
135 and you'll be taken to that exact spot in the source file."
137 "List of tips. Add more !")
139 (defvar xetla-tips-number 0
140 "Number of the last tip viewed.
141 Will be saved in state.el")
143 (defun xetla-tips-message-number (number)
144 "Return the message number NUMBER, as a string."
145 (let ((number (mod number (length xetla-tips-array))))
146 (aref xetla-tips-array number)))
148 (define-derived-mode xetla-tips-mode fundamental-mode "xetla-tips"
149 "Major mode for buffers displaying tip of the day.
152 \\{xetla-tips-mode-map}"
153 (toggle-read-only 1))
156 (defun xetla-tips-popup-number (number)
157 "Pops up tip number NUMBER."
158 (let ((message (xetla-tips-message-number number)))
159 (switch-to-buffer (get-buffer-create "*xetla-tip*"))
161 (let ((inhibit-read-only t))
163 (insert (xetla-face-add
164 "************************* Did you know? *************************"
167 (insert (substitute-command-keys message))
169 (insert (xetla-face-add
170 "*********************************************************************"
172 (goto-char (point-min)))))
174 (defun xetla-tips-popup-maybe ()
175 "Pop up a buffer with a tip if tips are enabled.
177 see `xetla-tips-enabled'."
178 (when xetla-tips-enabled
181 (defun xetla-tips-popup (&optional direction)
182 "Pop up a buffer with a tip message.
184 Don't use this function from XEtla. Use `xetla-tips-popup-maybe'
188 (xetla-tips-popup-number xetla-tips-number)
189 (setq xetla-tips-number
190 (mod (+ xetla-tips-number (or direction 1)) (length xetla-tips-array)))
193 (defun xetla-tips-next-tip ()
196 (xetla-tips-popup 1))
198 (defun xetla-tips-previous-tip ()
201 (xetla-tips-popup -1))
204 (autoload 'customize-group "cus-edit" nil t))
206 (defun xetla-tips-customize ()
207 "Run customize group for xetla-tips."
209 (customize-group 'xetla-tips))
211 (provide 'xetla-tips)
212 ;;; xetla-tips.el ends here