1 ;;; gnus-cus.el --- customization commands for Gnus
3 ;; Copyright (C) 1996,1999 Free Software Foundation, Inc.
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
35 ;; There should be special validation for this.
36 (define-widget 'gnus-email-address 'string
39 (defun gnus-custom-mode ()
40 "Major mode for editing Gnus customization buffers.
42 The following commands are available:
44 \\[widget-forward] Move to next button or editable field.
45 \\[widget-backward] Move to previous button or editable field.
46 \\[widget-button-click] Activate button under the mouse pointer.
47 \\[widget-button-press] Activate button under point.
49 Entry to this mode calls the value of `gnus-custom-mode-hook'
50 if that value is non-nil."
51 (kill-all-local-variables)
52 (setq major-mode 'gnus-custom-mode
53 mode-name "Gnus Customize")
54 (use-local-map widget-keymap)
55 (gnus-run-hooks 'gnus-custom-mode-hook))
57 ;;; Group Customization:
59 (defconst gnus-group-parameters
60 '((to-address (gnus-email-address :tag "To Address") "\
61 This will be used when doing followups and posts.
63 This is primarily useful in mail groups that represent closed
64 mailing lists--mailing lists where it's expected that everybody that
65 writes to the mailing list is subscribed to it. Since using this
66 parameter ensures that the mail only goes to the mailing list itself,
67 it means that members won't receive two copies of your followups.
69 Using `to-address' will actually work whether the group is foreign or
70 not. Let's say there's a group on the server that is called
71 `fa.4ad-l'. This is a real newsgroup, but the server has gotten the
72 articles from a mail-to-news gateway. Posting directly to this group
73 is therefore impossible--you have to send mail to the mailing list
76 The gnus-group-split mail splitting mechanism will behave as if this
77 address was listed in gnus-group-split Addresses (see below).")
79 (to-list (gnus-email-address :tag "To List") "\
80 This address will be used when doing a `a' in the group.
82 It is totally ignored when doing a followup--except that if it is
83 present in a news group, you'll get mail group semantics when doing
86 The gnus-group-split mail splitting mechanism will behave as if this
87 address was listed in gnus-group-split Addresses (see below).")
89 (extra-aliases (choice
95 (gnus-email-address :tag "Address")))
96 (gnus-email-address :tag "Address")) "\
97 Store messages posted from or to this address in this group.
99 You must be using gnus-group-split for this to work. The VALUE of the
100 nnmail-split-fancy SPLIT generated for this group will match these
103 (split-regexp (regexp :tag "gnus-group-split Regular Expression") "\
104 Like gnus-group-split Address, but expects a regular expression.")
106 (split-exclude (list :tag "gnus-group-split Restricts"
108 :inline t (regexp :tag "Restrict"))) "\
109 Regular expression that cancels gnus-group-split matches.
111 Each entry is added to the nnmail-split-fancy SPLIT as a separate
114 (split-spec (choice :tag "gnus-group-split Overrider"
115 (sexp :tag "Fancy Split")
116 (const :tag "Catch All" catch-all)
117 (const :tag "Ignore" nil)) "\
118 Override all other gnus-group-split fields.
120 In `Fancy Split', you can enter any nnmail-split-fancy SPLIT. Note
121 that the name of this group won't be automatically assumed, you have
122 to add it to the SPLITs yourself. This means you can use such splits
123 to split messages to other groups too.
125 If you select `Catch All', this group will get postings for any
126 messages not matched in any other group. It overrides the variable
127 gnus-group-split-default-catch-all-group.
129 Selecting `Ignore' forces no SPLIT to be generated for this group,
130 disabling all other gnus-group-split fields.")
132 (broken-reply-to (const :tag "Broken Reply To" t) "\
133 Ignore `Reply-To' headers in this group.
135 That can be useful if you're reading a mailing list group where the
136 listserv has inserted `Reply-To' headers that point back to the
137 listserv itself. This is broken behavior. So there!")
139 (to-group (string :tag "To Group") "\
140 All posts will be send to the specified group.")
142 (gcc-self (choice :tag "GCC"
146 (string :format "%v" :hide-front-space t)) "\
147 Specify default value for GCC header.
149 If this symbol is present in the group parameter list and set to `t',
150 new composed messages will be `Gcc''d to the current group. If it is
151 present and set to `none', no `Gcc:' header will be generated, if it
152 is present and a string, this string will be inserted literally as a
153 `gcc' header (this symbol takes precedence over any default `Gcc'
154 rules as described later).")
156 (banner (choice :tag "Banner"
159 Banner to be removed from articles.")
161 (auto-expire (const :tag "Automatic Expire" t) "\
162 All articles that are read will be marked as expirable.")
164 (total-expire (const :tag "Total Expire" t) "\
165 All read articles will be put through the expiry process
167 This happens even if they are not marked as expirable.
170 (expiry-wait (choice :tag "Expire Wait"
174 (number :hide-front-space t
178 Overrides any `nnmail-expiry-wait' and `nnmail-expiry-wait-function'
179 when expiring expirable messages. The value can either be a number of
180 days (not necessarily an integer) or the symbols `never' or
183 (score-file (file :tag "Score File") "\
184 Make the specified file into the current score file.
185 This means that all score commands you issue will end up in this file.")
187 (adapt-file (file :tag "Adapt File") "\
188 Make the specified file into the current adaptive file.
189 All adaptive score entries will be put into this file.")
191 (admin-address (gnus-email-address :tag "Admin Address") "\
192 Administration address for a mailing list.
194 When unsubscribing to a mailing list you should never send the
195 unsubscription notice to the mailing list itself. Instead, you'd
196 send messages to the administrative address. This parameter allows
197 you to put the admin address somewhere convenient.")
199 (display (choice :tag "Display"
203 Which articles to display on entering the group.
206 Display all articles, both read and unread.
209 Display the default visible articles, which normally includes
210 unread and ticked articles.")
212 (comment (string :tag "Comment") "\
213 An arbitrary comment on the group.")
215 (visible (const :tag "Permanently visible" t) "\
216 Always display this group, even when there are no unread articles
219 (charset (symbol :tag "Charset") "\
220 The default charset to use in the group.")
223 (choice :tag "Ignored charsets"
225 (repeat (symbol))) "\
226 List of charsets that should be ignored.
228 When these charsets are used in the \"charset\" parameter, the
229 default charset will be used instead.")
232 (choice :tag "Highlight words"
234 (repeat (list (regexp :tag "Highlight regexp")
235 (number :tag "Group for entire word" 0)
236 (number :tag "Group for displayed part" 0)
238 gnus-emphasis-highlight-words))))
240 See gnus-emphasis-alist."))
241 "Alist of valid group or topic parameters.
243 Each entry has the form (NAME TYPE DOC), where NAME is the parameter
244 itself (a symbol), TYPE is the parameters type (a sexp widget), and
245 DOC is a documentation string for the parameter.")
247 (defconst gnus-extra-topic-parameters
248 '((subscribe (regexp :tag "Subscribe") "\
249 If `gnus-subscribe-newsgroup-method' is set to
250 `gnus-subscribe-topics', new groups that matches this regexp will
251 automatically be subscribed to this topic"))
252 "Alist of topic parameters that are not also group parameters.
254 Each entry has the form (NAME TYPE DOC), where NAME is the parameter
255 itself (a symbol), TYPE is the parameters type (a sexp widget), and
256 DOC is a documentation string for the parameter.")
258 (defconst gnus-extra-group-parameters nil
259 "Alist of group parameters that are not also topic parameters.
261 Each entry has the form (NAME TYPE DOC), where NAME is the parameter
262 itself (a symbol), TYPE is the parameters type (a sexp widget), and
263 DOC is a documentation string for the parameter.")
264 (defvar gnus-custom-params)
265 (defvar gnus-custom-method)
266 (defvar gnus-custom-group)
267 (defvar gnus-custom-topic)
269 (defun gnus-group-customize (group &optional topic)
270 "Edit the group or topic on the current line."
271 (interactive (list (gnus-group-group-name) (gnus-group-topic-name)))
273 (types (mapcar (lambda (entry)
274 `(cons :format "%v%h\n"
276 (const :format "" ,(nth 0 entry))
278 (append gnus-group-parameters
280 gnus-extra-group-parameters
281 gnus-extra-topic-parameters)))))
282 (unless (or group topic)
283 (error "No group on current line"))
284 (when (and group topic)
285 (error "Both a group an topic on current line"))
286 (unless (or topic (setq info (gnus-get-info group)))
287 (error "Killed group; can't be edited"))
289 (kill-buffer (gnus-get-buffer-create "*Gnus Customize*"))
290 (switch-to-buffer (gnus-get-buffer-create "*Gnus Customize*"))
292 (make-local-variable 'gnus-custom-group)
293 (setq gnus-custom-group group)
294 (make-local-variable 'gnus-custom-topic)
295 (setq gnus-custom-topic topic)
296 (widget-insert "Customize the ")
298 (widget-create 'info-link
299 :help-echo "Push me to learn more."
300 :tag "group parameters"
301 "(gnus)Group Parameters")
302 (widget-create 'info-link
303 :help-echo "Push me to learn more."
304 :tag "topic parameters"
305 "(gnus)Topic Parameters"))
306 (widget-insert " for <")
307 (widget-insert (or group topic))
308 (widget-insert "> and press ")
309 (widget-create 'push-button
311 :help-echo "Push me when done customizing."
312 :action 'gnus-group-customize-done)
313 (widget-insert ".\n\n")
314 (make-local-variable 'gnus-custom-params)
315 (setq gnus-custom-params
316 (widget-create 'group
318 (gnus-info-params info)
319 (gnus-topic-parameters topic))
325 These special paramerters are recognized by Gnus.
326 Check the [ ] for the parameters you want to apply to this group or
327 to the groups in this topic, then edit the value to suit your taste."
331 :format "%t:\n%h%v%i\n\n"
333 Set variables local to the group you are entering.
335 If you want to turn threading off in `news.answers', you could put
336 `(gnus-show-threads nil)' in the group parameters of that group.
337 `gnus-show-threads' will be made into a local variable in the summary
338 buffer you enter, and the form `nil' will be `eval'ed there.
340 This can also be used as a group-specific hook function, if you'd
341 like. If you want to hear a beep when you enter a group, you could
342 put something like `(dummy-variable (ding))' in the parameters of that
343 group. `dummy-variable' will be set to the result of the `(ding)'
344 form, but who cares?"
345 (list :format "%v" :value (nil nil)
346 (symbol :tag "Variable")
351 :tag "Unknown entries"
354 (widget-insert "\n\nYou can also edit the ")
355 (widget-create 'info-link
357 :help-echo "Push me to learn more about select methods."
358 "(gnus)Select Methods")
359 (widget-insert " for the group.\n")
360 (setq gnus-custom-method
363 :value (gnus-info-method info))))
364 (use-local-map widget-keymap)
366 (goto-char (point-min))))
368 (defun gnus-group-customize-done (&rest ignore)
369 "Apply changes and bury the buffer."
371 (if gnus-custom-topic
372 (gnus-topic-set-parameters gnus-custom-topic
373 (widget-value gnus-custom-params))
374 (gnus-group-edit-group-done 'params gnus-custom-group
375 (widget-value gnus-custom-params))
376 (gnus-group-edit-group-done 'method gnus-custom-group
377 (widget-value gnus-custom-method)))
380 ;;; Score Customization:
382 (defconst gnus-score-parameters
383 '((mark (number :tag "Mark") "\
384 The value of this entry should be a number.
385 Any articles with a score lower than this number will be marked as read.")
387 (expunge (number :tag "Expunge") "\
388 The value of this entry should be a number.
389 Any articles with a score lower than this number will be removed from
390 the summary buffer.")
392 (mark-and-expunge (number :tag "Mark-and-expunge") "\
393 The value of this entry should be a number.
394 Any articles with a score lower than this number will be marked as
395 read and removed from the summary buffer.")
397 (thread-mark-and-expunge (number :tag "Thread-mark-and-expunge") "\
398 The value of this entry should be a number.
399 All articles that belong to a thread that has a total score below this
400 number will be marked as read and removed from the summary buffer.
401 `gnus-thread-score-function' says how to compute the total score
404 (files (repeat :inline t :tag "Files" file) "\
405 The value of this entry should be any number of file names.
406 These files are assumed to be score files as well, and will be loaded
407 the same way this one was.")
409 (exclude-files (repeat :inline t :tag "Exclude-files" file) "\
410 The clue of this entry should be any number of files.
411 These files will not be loaded, even though they would normally be so,
412 for some reason or other.")
414 (eval (sexp :tag "Eval" :value nil) "\
415 The value of this entry will be `eval'el.
416 This element will be ignored when handling global score files.")
418 (read-only (boolean :tag "Read-only" :value t) "\
419 Read-only score files will not be updated or saved.
420 Global score files should feature this atom.")
422 (orphan (number :tag "Orphan") "\
423 The value of this entry should be a number.
424 Articles that do not have parents will get this number added to their
425 scores. Imagine you follow some high-volume newsgroup, like
426 `comp.lang.c'. Most likely you will only follow a few of the threads,
427 also want to see any new threads.
429 You can do this with the following two score file entries:
432 (mark-and-expunge -100)
434 When you enter the group the first time, you will only see the new
435 threads. You then raise the score of the threads that you find
436 interesting (with `I T' or `I S'), and ignore (`C y') the rest.
437 Next time you enter the group, you will see new articles in the
438 interesting threads, plus any new threads.
440 I.e.---the orphan score atom is for high-volume groups where there
441 exist a few interesting threads which can't be found automatically
442 by ordinary scoring rules.")
444 (adapt (choice :tag "Adapt"
448 :hide-front-space t)) "\
449 This entry controls the adaptive scoring.
450 If it is `t', the default adaptive scoring rules will be used. If it
451 is `ignore', no adaptive scoring will be performed on this group. If
452 it is a list, this list will be used as the adaptive scoring rules.
453 If it isn't present, or is something other than `t' or `ignore', the
454 default adaptive scoring rules will be used. If you want to use
455 adaptive scoring on most groups, you'd set `gnus-use-adaptive-scoring'
456 to `t', and insert an `(adapt ignore)' in the groups where you do not
457 want adaptive scoring. If you only want adaptive scoring in a few
458 groups, you'd set `gnus-use-adaptive-scoring' to `nil', and insert
459 `(adapt t)' in the score files of the groups where you want it.")
461 (adapt-file (file :tag "Adapt-file") "\
462 All adaptive score entries will go to the file named by this entry.
463 It will also be applied when entering the group. This atom might
464 be handy if you want to adapt on several groups at once, using the
465 same adaptive file for a number of groups.")
467 (local (repeat :tag "Local"
468 (group :value (nil nil)
469 (symbol :tag "Variable")
470 (sexp :tag "Value"))) "\
471 The value of this entry should be a list of `(VAR VALUE)' pairs.
472 Each VAR will be made buffer-local to the current summary buffer,
473 and set to the value specified. This is a convenient, if somewhat
474 strange, way of setting variables in some groups if you don't like
476 (touched (sexp :format "Touched\n") "Internal variable."))
477 "Alist of valid symbolic score parameters.
479 Each entry has the form (NAME TYPE DOC), where NAME is the parameter
480 itself (a symbol), TYPE is the parameters type (a sexp widget), and DOC is a
481 documentation string for the parameter.")
483 (define-widget 'gnus-score-string 'group
484 "Edit score entries for string-valued headers."
485 :convert-widget 'gnus-score-string-convert)
487 (defun gnus-score-string-convert (widget)
488 ;; Set args appropriately.
489 (let* ((tag (widget-get widget :tag))
490 (item `(const :format "" :value ,(downcase tag)))
491 (match '(string :tag "Match"))
492 (score '(choice :tag "Score"
493 (const :tag "default" nil)
494 (integer :format "%v"
495 :hide-front-space t)))
496 (expire '(choice :tag "Expire"
497 (const :tag "off" nil)
498 (integer :format "%v"
499 :hide-front-space t)))
500 (type '(choice :tag "Type"
502 ;; I should really create a forgiving :match
503 ;; function for each type below, that only
504 ;; looked at the first letter.
505 (const :tag "Regexp" r)
506 (const :tag "Regexp (fixed case)" R)
507 (const :tag "Substring" s)
508 (const :tag "Substring (fixed case)" S)
509 (const :tag "Exact" e)
510 (const :tag "Exact (fixed case)" E)
511 (const :tag "Word" w)
512 (const :tag "Word (fixed case)" W)
513 (const :tag "default" nil)))
514 (group `(group ,match ,score ,expire ,type))
515 (doc (concat (or (widget-get widget :doc)
516 (concat "Change score based on the " tag
519 You can have an arbitrary number of score entries for this header,
520 each score entry has four elements:
522 1. The \"match element\". This should be the string to look for in the
525 2. The \"score element\". This number should be an integer in the
526 neginf to posinf interval. This number is added to the score
527 of the article if the match is successful. If this element is
528 not present, the `gnus-score-interactive-default-score' number
529 will be used instead. This is 1000 by default.
531 3. The \"date element\". This date says when the last time this score
532 entry matched, which provides a mechanism for expiring the
533 score entries. It this element is not present, the score
534 entry is permanent. The date is represented by the number of
535 days since December 31, 1 ce.
537 4. The \"type element\". This element specifies what function should
538 be used to see whether this score entry matches the article.
540 There are the regexp, as well as substring types, and exact match,
541 and word match types. If this element is not present, Gnus will
542 assume that substring matching should be used. There is case
543 sensitive variants of all match types.")))
544 (widget-put widget :args `(,item
549 :format "%t:\n%h%v%i\n\n"
551 :value ("" nil nil s)
556 (define-widget 'gnus-score-integer 'group
557 "Edit score entries for integer-valued headers."
558 :convert-widget 'gnus-score-integer-convert)
560 (defun gnus-score-integer-convert (widget)
561 ;; Set args appropriately.
562 (let* ((tag (widget-get widget :tag))
563 (item `(const :format "" :value ,(downcase tag)))
564 (match '(integer :tag "Match"))
565 (score '(choice :tag "Score"
566 (const :tag "default" nil)
567 (integer :format "%v"
568 :hide-front-space t)))
569 (expire '(choice :tag "Expire"
570 (const :tag "off" nil)
571 (integer :format "%v"
572 :hide-front-space t)))
573 (type '(choice :tag "Type"
580 (group `(group ,match ,score ,expire ,type))
581 (doc (concat (or (widget-get widget :doc)
582 (concat "Change score based on the " tag
584 (widget-put widget :args `(,item
589 :format "%t:\n%h%v%i\n\n"
593 (define-widget 'gnus-score-date 'group
594 "Edit score entries for date-valued headers."
595 :convert-widget 'gnus-score-date-convert)
597 (defun gnus-score-date-convert (widget)
598 ;; Set args appropriately.
599 (let* ((tag (widget-get widget :tag))
600 (item `(const :format "" :value ,(downcase tag)))
601 (match '(string :tag "Match"))
602 (score '(choice :tag "Score"
603 (const :tag "default" nil)
604 (integer :format "%v"
605 :hide-front-space t)))
606 (expire '(choice :tag "Expire"
607 (const :tag "off" nil)
608 (integer :format "%v"
609 :hide-front-space t)))
610 (type '(choice :tag "Type"
616 (group `(group ,match ,score ,expire ,type))
617 (doc (concat (or (widget-get widget :doc)
618 (concat "Change score based on the " tag
621 For the Date header we have three kinda silly match types: `before',
622 `at' and `after'. I can't really imagine this ever being useful, but,
623 like, it would feel kinda silly not to provide this function. Just in
624 case. You never know. Better safe than sorry. Once burnt, twice
625 shy. Don't judge a book by its cover. Never not have sex on a first
626 date. (I have been told that at least one person, and I quote,
627 \"found this function indispensable\", however.)
629 A more useful match type is `regexp'. With it, you can match the date
630 string using a regular expression. The date is normalized to ISO8601
631 compact format first---`YYYYMMDDTHHMMSS'. If you want to match all
632 articles that have been posted on April 1st in every year, you could
633 use `....0401.........' as a match string, for instance. (Note that
634 the date is kept in its original time zone, so this will match
635 articles that were posted when it was April 1st where the article was
636 posted from. Time zones are such wholesome fun for the whole family,
638 (widget-put widget :args `(,item
643 :format "%t:\n%h%v%i\n\n"
647 (defvar gnus-custom-scores)
648 (defvar gnus-custom-score-alist)
650 (defun gnus-score-customize (file)
651 "Customize score file FILE."
652 (interactive (list gnus-current-score-file))
653 (let ((scores (gnus-score-load file))
654 (types (mapcar (lambda (entry)
655 `(group :format "%v%h\n"
657 (const :format "" ,(nth 0 entry))
659 gnus-score-parameters)))
661 (kill-buffer (gnus-get-buffer-create "*Gnus Customize*"))
662 (switch-to-buffer (gnus-get-buffer-create "*Gnus Customize*"))
664 (make-local-variable 'gnus-custom-score-alist)
665 (setq gnus-custom-score-alist scores)
666 (widget-insert "Customize the ")
667 (widget-create 'info-link
668 :help-echo "Push me to learn more."
670 "(gnus)Score File Format")
671 (widget-insert " for\n\t")
673 (widget-insert "\nand press ")
674 (widget-create 'push-button
676 :help-echo "Push me when done customizing."
677 :action 'gnus-score-customize-done)
679 Check the [ ] for the entries you want to apply to this score file, then
680 edit the value to suit your taste. Don't forget to mark the checkbox,
681 if you do all your changes will be lost. ")
682 (widget-create 'push-button
683 :action (lambda (&rest ignore)
684 (require 'gnus-audio)
685 (gnus-audio-play "Evil_Laugh.au"))
687 (widget-insert "\n\n")
688 (make-local-variable 'gnus-custom-scores)
689 (setq gnus-custom-scores
690 (widget-create 'group
692 `(checklist :inline t
694 (gnus-score-string :tag "From")
695 (gnus-score-string :tag "Subject")
696 (gnus-score-string :tag "References")
697 (gnus-score-string :tag "Xref")
698 (gnus-score-string :tag "Extra")
699 (gnus-score-string :tag "Message-ID")
700 (gnus-score-integer :tag "Lines")
701 (gnus-score-integer :tag "Chars")
702 (gnus-score-date :tag "Date")
703 (gnus-score-string :tag "Head"
705 Match all headers in the article.
707 Using one of `Head', `Body', `All' will slow down scoring considerable.
709 (gnus-score-string :tag "Body"
711 Match the body sans header of the article.
713 Using one of `Head', `Body', `All' will slow down scoring considerable.
715 (gnus-score-string :tag "All"
717 Match the entire article, including both headers and body.
719 Using one of `Head', `Body', `All' will slow down scoring
722 (gnus-score-string :tag
725 Score all followups to the specified authors.
727 This entry is somewhat special, in that it will match the `From:'
728 header, and affect the score of not only the matching articles, but
729 also all followups to the matching articles. This allows you
730 e.g. increase the score of followups to your own articles, or decrease
731 the score of followups to the articles of some known trouble-maker.
733 (gnus-score-string :tag "Thread"
735 Add a score entry on all articles that are part of a thread.
737 This match key works along the same lines as the `Followup' match key.
738 If you say that you want to score on a (sub-)thread that is started by
739 an article with a `Message-ID' X, then you add a `thread' match. This
740 will add a new `thread' match for each article that has X in its
741 `References' header. (These new `thread' matches will use the
742 `Message-ID's of these matching articles.) This will ensure that you
743 can raise/lower the score of an entire thread, even though some
744 articles in the thread may not have complete `References' headers.
745 Note that using this may lead to undeterministic scores of the
746 articles in the thread.
750 :tag "Unknown entries"
752 (use-local-map widget-keymap)
755 (defun gnus-score-customize-done (&rest ignore)
756 "Reset the score alist with the present value."
757 (let ((alist gnus-custom-score-alist)
758 (value (widget-value gnus-custom-scores)))
759 (setcar alist (car value))
760 (setcdr alist (cdr value))
761 (gnus-score-set 'touched '(t) alist))
768 ;;; gnus-cus.el ends here