Commit f99b0e51 authored by Joel Rosdahl's avatar Joel Rosdahl
Browse files

Removed some erroneous indentation.

parent 4c2743b1
2002-03-02 Joel Rosdahl <joel@lysator.liu.se>
* commands2.el: Removed some erroneous indentation.
* lyskom-buttons.el (lyskom-view-url-windows): Rewritten (based on
work by Klaus Zeuge).
......
;;;;; -*-coding: iso-8859-1;-*-
;;;;;
;;;;; $Id$
;;;;; Copyright (C) 1991-2002 Lysator Academic Computer Association.
;;;;;
;;;;; This file is part of the LysKOM Emacs LISP client.
;;;;;
;;;;; LysKOM is free software; you can redistribute it and/or modify it
;;;;; under the terms of the GNU General Public License as published by
;;;;; the Free Software Foundation; either version 2, or (at your option)
;;;;; any later version.
;;;;;
;;;;; LysKOM is distributed in the hope that it will be useful, but WITHOUT
;;;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
;;;;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
;;;;; for more details.
;;;;;
;;;;; You should have received a copy of the GNU General Public License
;;;;; along with LysKOM; see the file COPYING. If not, write to
;;;;; Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
;;;;; or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
;;;;; MA 02139, USA.
;;;;;
;;;;; Please mail bug reports to bug-lyskom@lysator.liu.se.
;;;;;
;;;; ================================================================
;;;; ================================================================
;;;;
;;;; File: commands2.el
;;;;
;;;; This file contains the code for some high level commands.
;;;;
(setq lyskom-clientversion-long
;;;;; -*-coding: iso-8859-1;-*-
;;;;;
;;;;; $Id$
;;;;; Copyright (C) 1991-2002 Lysator Academic Computer Association.
;;;;;
;;;;; This file is part of the LysKOM Emacs LISP client.
;;;;;
;;;;; LysKOM is free software; you can redistribute it and/or modify it
;;;;; under the terms of the GNU General Public License as published by
;;;;; the Free Software Foundation; either version 2, or (at your option)
;;;;; any later version.
;;;;;
;;;;; LysKOM is distributed in the hope that it will be useful, but WITHOUT
;;;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
;;;;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
;;;;; for more details.
;;;;;
;;;;; You should have received a copy of the GNU General Public License
;;;;; along with LysKOM; see the file COPYING. If not, write to
;;;;; Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
;;;;; or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
;;;;; MA 02139, USA.
;;;;;
;;;;; Please mail bug reports to bug-lyskom@lysator.liu.se.
;;;;;
;;;; ================================================================
;;;; ================================================================
;;;;
;;;; File: commands2.el
;;;;
;;;; This file contains the code for some high level commands.
;;;;
(setq lyskom-clientversion-long
(concat lyskom-clientversion-long
"$Id$\n"))
(eval-when-compile
(eval-when-compile
(require 'lyskom-command "command"))
;;; ================================================================
;;; Lista medlemsskap - List membership
;;; ================================================================
;;; Lista medlemsskap - List membership
;;; Author: Linus Tolke
;;; Rewritten by ceder
;;; Author: Linus Tolke
;;; Rewritten by ceder
;; This functions is left in its "asynchronous way".
(def-kom-command kom-membership ()
;; This functions is left in its "asynchronous way".
(def-kom-command kom-membership ()
"Show memberships last visited, priority, unread and name."
(interactive)
(let ((buffer (lyskom-get-buffer-create 'list-membership
......@@ -69,7 +69,7 @@
(lyskom-display-buffer buffer))
(lyskom-update-membership-buffer)))
(defun lyskom-update-membership-buffer ()
(defun lyskom-update-membership-buffer ()
(let ((buf (car (lyskom-buffers-of-category 'list-membership))))
(when (buffer-live-p buf)
(let ((inhibit-read-only t))
......@@ -80,7 +80,7 @@
(membership->conf-no x)
x buf))))))
(defun lyskom-update-membership-when-changed ()
(defun lyskom-update-membership-when-changed ()
(let ((buffer (car (lyskom-buffers-of-category 'list-membership))))
(if (buffer-live-p buffer)
(save-excursion (set-buffer buffer)
......@@ -91,12 +91,12 @@
(defun lyskom-memb-received-1 (conf-stat membership buffer)
(defun lyskom-memb-received-1 (conf-stat membership buffer)
"Part of kom-membership.
Get maps for the conference CONF-STAT. MEMBERSHIP is the users
membership in that conference. Call lyskom-memb-received with
the resulting MAP, CONF-STAT, MEMBERSHIP and BUFFER.
Args: CONF-STAT MEMBERSHIP BUFFER."
Get maps for the conference CONF-STAT. MEMBERSHIP is the users
membership in that conference. Call lyskom-memb-received with
the resulting MAP, CONF-STAT, MEMBERSHIP and BUFFER.
Args: CONF-STAT MEMBERSHIP BUFFER."
(if (/= (conf-stat->conf-no conf-stat)
(membership->conf-no membership))
(signal 'lyskom-internal-error '("lyskom-memb-received-1")))
......@@ -118,10 +118,10 @@
(- first-wanted))
conf-stat membership buffer)))))
(defun lyskom-memb-received (map conf-stat membership buffer)
(defun lyskom-memb-received (map conf-stat membership buffer)
"Args: MAP CONF-STAT MEMBERSHIP BUFFER.
Prints membership in a conferences.
MAP may be nil if there are no new texts."
Prints membership in a conferences.
MAP may be nil if there are no new texts."
(save-window-excursion
(set-buffer buffer)
(goto-char (point-max))
......@@ -145,17 +145,17 @@
conf-stat))))
;;; ================================================================
;;; Status (f|r) M|te - Status for a conference
;;; ================================================================
;;; Status (f|r) M|te - Status for a conference
;;; Author: ceder (with some help by Linus)
;;; much enhanced by Inge Wallin (lyskom-status-conf-2 and beyond)
;;; Author: ceder (with some help by Linus)
;;; much enhanced by Inge Wallin (lyskom-status-conf-2 and beyond)
(def-kom-command kom-status-conf (&optional conf-no)
(def-kom-command kom-status-conf (&optional conf-no)
"Prints conference status.
If argument CONF-NO is existing and non-nil then this conference is used.
otherwise: the conference is read with lyskom-completing-read."
If argument CONF-NO is existing and non-nil then this conference is used.
otherwise: the conference is read with lyskom-completing-read."
(interactive)
(let ((conf-no
(or conf-no
......@@ -337,14 +337,14 @@
(member->pers-no member)))))))))))
;;; ================================================================
;;; Status (f|r) Person - status for a person
;;; ================================================================
;;; Status (f|r) Person - status for a person
;;; Author: ceder
;;; Heavily enhanced: Inge Wallin (lyskom-status-pers-3 and beyond)
;;; Author: ceder
;;; Heavily enhanced: Inge Wallin (lyskom-status-pers-3 and beyond)
(def-kom-command kom-status-person (&optional pers-no)
(def-kom-command kom-status-person (&optional pers-no)
"Prints status for a person."
(interactive)
(let ((pers-no
......@@ -510,15 +510,15 @@
;;; ================================================================
;;; Skicka meddelande - Send message
;;; ================================================================
;;; Skicka meddelande - Send message
;;; Author: Inge Wallin
;;; Rewritten to use lyskom-read-conf-no by Linus Tolke
;;; Modified to use default recipient by David Byers
;;; Author: Inge Wallin
;;; Rewritten to use lyskom-read-conf-no by Linus Tolke
;;; Modified to use default recipient by David Byers
(def-kom-command kom-send-message (&optional who message)
(def-kom-command kom-send-message (&optional who message)
"Send a message to one of the users in KOM right now."
(interactive)
(let* ((tmp nil)
......@@ -563,34 +563,34 @@
(lyskom-send-message target message))))
(def-kom-command kom-send-alarm (&optional message)
(def-kom-command kom-send-alarm (&optional message)
"Send a message to all of the users in KOM right now."
(interactive)
(lyskom-insert (lyskom-get-string 'message-all-info))
(lyskom-send-message 0 message))
(defvar lyskom-message-recipient)
(defvar lyskom-message-string)
(defvar lyskom-message-recipient)
(defvar lyskom-message-string)
(defun lyskom-send-message-minibuffer-setup-hook ()
(defun lyskom-send-message-minibuffer-setup-hook ()
(unwind-protect
(run-hooks 'lyskom-send-message-setup-hook)
(remove-hook 'minibuffer-setup-hook
'lyskom-send-message-minibuffer-setup-hook)))
(defun lyskom-send-message-minibuffer-exit-hook ()
(defun lyskom-send-message-minibuffer-exit-hook ()
(unwind-protect
(run-hooks 'lyskom-send-message-exit-hook)
(remove-hook 'minibuffer-exit-hook
'lyskom-send-message-minibuffer-exit-hook)))
(defun lyskom-send-message (pers-no
(defun lyskom-send-message (pers-no
message &optional dontshow)
"Send a message to the person with the number PERS-NO. PERS-NO == 0
means send the message to everybody. MESSAGE is the message to
send. If DONTSHOW is non-nil, don't display the sent message."
means send the message to everybody. MESSAGE is the message to
send. If DONTSHOW is non-nil, don't display the sent message."
(let* ((lyskom-message-string nil)
(reply nil)
(lyskom-message-recipient nil)
......@@ -637,7 +637,7 @@
(lyskom-insert-string 'interrupted)) ;+++ lyskom-errno
))
(defun lyskom-send-message-trim-newlines ()
(defun lyskom-send-message-trim-newlines ()
(when (stringp lyskom-message-string)
(let ((size (length lyskom-message-string)))
(while (and (> size 0)
......@@ -652,15 +652,15 @@
(t (setq lyskom-message-string (substring lyskom-message-string
0 size)))))))
(lyskom-external-function resize-minibuffer-setup)
(lyskom-external-function resize-minibuffer-setup)
(defun lyskom-send-message-turn-off-resize-on-exit ()
(defun lyskom-send-message-turn-off-resize-on-exit ()
(resize-minibuffer-mode -1)
(remove-hook 'lyskom-send-message-exit-hook
'lyskom-send-message-turn-off-resize-on-exit))
(defvar resize-minibuffer-mode)
(defun lyskom-send-message-resize-minibuffer ()
(defvar resize-minibuffer-mode)
(defun lyskom-send-message-resize-minibuffer ()
"Temporarily turn on resizing of minibuffer"
(unless resize-minibuffer-mode
(resize-minibuffer-mode 1)
......@@ -669,19 +669,19 @@
'lyskom-send-message-turn-off-resize-on-exit)))
(defun lyskom-send-message-auto-fill ()
(defun lyskom-send-message-auto-fill ()
"Temporarily turn on auto fill in minibuffer"
(setq fill-column 78) ;+++ Ta bort?
(auto-fill-mode 1))
;;; ================================================================
;;; Endast l{sa senaste - Set unread articles in a conf.
;;; (Skip or re-read articles).
;;; ================================================================
;;; Endast l{sa senaste - Set unread articles in a conf.
;;; (Skip or re-read articles).
;;; Author: Linus Tolke
;;; Rehacked: David K}gedal
;;; Author: Linus Tolke
;;; Rehacked: David K}gedal
(def-kom-command kom-set-unread (&optional arg conf-no)
......@@ -722,28 +722,28 @@
;;; ================================================================
;;; Lista Nyheter - List News
;;; ================================================================
;;; Lista Nyheter - List News
;;; Author: Linus Tolke
;;; Rehacked: Inge Wallin, Johan Sundstrm
;;; Author: Linus Tolke
;;; Rehacked: Inge Wallin, Johan Sundstrm
(defvar lyskom-special-conf-name "\\`\\(Inl.gg .t mig\\|NL:\\)\\'"
(defvar lyskom-special-conf-name "\\`\\(Inl.gg .t mig\\|NL:\\)\\'"
"Regexp to match conf names that are special.")
(defvar lyskom-iter-list-news-total-confs)
(defvar lyskom-iter-list-news-mship-confs)
(defvar lyskom-iter-list-news-shown-unreads)
(defvar lyskom-iter-list-news-shown-confs)
(defvar lyskom-iter-list-news-total-unreads)
(defvar lyskom-iter-list-news-total-confs)
(defvar lyskom-iter-list-news-total-confs)
(defvar lyskom-iter-list-news-mship-confs)
(defvar lyskom-iter-list-news-shown-unreads)
(defvar lyskom-iter-list-news-shown-confs)
(defvar lyskom-iter-list-news-total-unreads)
(defvar lyskom-iter-list-news-total-confs)
(defun lyskom-iter-list-news (unreads conf-stat at-least at-most)
(defun lyskom-iter-list-news (unreads conf-stat at-least at-most)
"Callback function used to show the number of unread messages of a
conference. It heavily relies on (and destructively modifies) its
environment."
conference. It heavily relies on (and destructively modifies) its
environment."
(when (and (or (not at-least)
(>= unreads at-least)) ; unreads within lower bound
(or (not at-most)
......@@ -769,11 +769,11 @@
(1+ lyskom-iter-list-news-total-confs)))
(def-kom-command kom-list-news (&optional num)
(def-kom-command kom-list-news (&optional num)
"Print the number of unread articles to the user. A prefix argument
of zero lists all conferences, a positive prefix arguments sets a
lower bound on the number of unread messages, whereas a negative
prefix argument sets an upper bound on the number of unread messages."
of zero lists all conferences, a positive prefix arguments sets a
lower bound on the number of unread messages, whereas a negative
prefix argument sets an upper bound on the number of unread messages."
(interactive "P")
(let ((num-arg (cond
((numberp num) num)
......@@ -834,15 +834,15 @@
lyskom-iter-list-news-total-confs))))
(defun lyskom-list-news (&optional callback &optional callback-args)
(defun lyskom-list-news (&optional callback &optional callback-args)
"With no arguments, returns a list of tuples (unread . conf-stat).
When called with a CALLBACK function, this function is called
iteratively as the list is built up. This function should take the two
arguments `number-of-unread-messages-in-conference' and `conf-stat'
and optionally any other arguments sent in the list CALLBACK-ARGS, and
its return value will form the elements of the list returned from
lyskom-list-news. The callback will only be fed conferences with at
least one unread message in them."
When called with a CALLBACK function, this function is called
iteratively as the list is built up. This function should take the two
arguments `number-of-unread-messages-in-conference' and `conf-stat'
and optionally any other arguments sent in the list CALLBACK-ARGS, and
its return value will form the elements of the list returned from
lyskom-list-news. The callback will only be fed conferences with at
least one unread message in them."
(unless kom-allow-incompleteness
(sit-for 0)
......@@ -861,17 +861,17 @@
;;; ================================================================
;;; V{nta - Idle wait
;;; ================================================================
;;; V{nta - Idle wait
(defun kom-busy-wait (arg)
(defun kom-busy-wait (arg)
"Sets the kom-session in wait-mode.
The wait-mode is interrupted when a text in a conference with higher priority
than that of the next text to be read.
If you want another priority to break that the ones higher that the next text
to be read, give the priority as a prefix argument.
When a text is received the new text is displayed."
The wait-mode is interrupted when a text in a conference with higher priority
than that of the next text to be read.
If you want another priority to break that the ones higher that the next text
to be read, give the priority as a prefix argument.
When a text is received the new text is displayed."
(interactive "P")
(lyskom-start-of-command 'kom-busy-wait)
(unwind-protect
......@@ -932,16 +932,16 @@
(t nil)))
;;; ================================================================
;;; Lista {rende - list summary
;;; ================================================================
;;; Lista {rende - list summary
;;; Author: Linus Tolke
;;; Author: Linus Tolke
(def-kom-command kom-list-summary (prefix)
(def-kom-command kom-list-summary (prefix)
"List a summary of the unread in the current conf.
The summary contains the date, number of lines, author and subject of the text
on one line."
The summary contains the date, number of lines, author and subject of the text
on one line."
(interactive "P")
(if (read-list-isempty lyskom-reading-list)
(lyskom-insert-string 'have-to-be-in-conf-with-unread)
......@@ -1013,13 +1013,13 @@ on one line."
(sit-for 0)))))
(defun lyskom-print-summary-line (text-stat text text-no year mon mday)
(defun lyskom-print-summary-line (text-stat text text-no year mon mday)
"Handle the info, fetch the author and print it.
Args: TEXT-STAT TEXT TEXT-NO YEAR MON MDAY.
Args: TEXT-STAT TEXT TEXT-NO YEAR MON MDAY.
The year, mon and mday are there to be able to choose format on the
day. Format is HH:MM(:SS) if the text is written today, otherwise
YYYY-MM-DD."
The year, mon and mday are there to be able to choose format on the
day. Format is HH:MM(:SS) if the text is written today, otherwise
YYYY-MM-DD."
(if (not (and text-stat text)) ;+++ B{ttre felhantering.
(lyskom-format-insert 'could-not-read text-no)
(let* ((lines (text-stat->no-of-lines text-stat))
......@@ -1059,12 +1059,12 @@ on one line."
;;; ============================================================
;;; kom-list-marks Lista markeringar
;;; Author: David Byers
;;; Modified by: Joel Rosdahl
;;; ============================================================
;;; kom-list-marks Lista markeringar
;;; Author: David Byers
;;; Modified by: Joel Rosdahl
(def-kom-command kom-list-marks (&optional which-mark)
(def-kom-command kom-list-marks (&optional which-mark)
"List texts marked with a particular mark number."
(interactive "P")
(when (not (numberp which-mark))
......@@ -1108,13 +1108,13 @@ on one line."
(sit-for 0))))
))
(defun lyskom-print-mark-summary-line (mark text-stat text text-no year day)
(defun lyskom-print-mark-summary-line (mark text-stat text text-no year day)
"Handle the info, fetch the author and print it.
Args: TEXT-STAT TEXT TEXT-NO YEAR DAY.
Args: TEXT-STAT TEXT TEXT-NO YEAR DAY.
The year and day is there to be able to choose format on the day.
Format is HH:MM(:SS) if the text is written today, otherwise
YYYY-MM-DD."
The year and day is there to be able to choose format on the day.
Format is HH:MM(:SS) if the text is written today, otherwise
YYYY-MM-DD."
(lyskom-format-insert (format "%%-%d#1s " (lyskom-max-mark-width))
(mark->symbolic-mark-type mark))
(if (not (and text-stat text)) ;+++ B{ttre felhantering.
......@@ -1149,23 +1149,23 @@ on one line."
text-no)
subject))))
(defun lyskom-symbolic-mark-type-string (mark-no)
(defun lyskom-symbolic-mark-type-string (mark-no)
"Return a symbolic name string for the mark-type of MARK."
(or (car-safe (rassoc mark-no kom-symbolic-marks-alist))
(int-to-string mark-no)))
(defun lyskom-max-mark-width ()
(defun lyskom-max-mark-width ()
(max 3
(apply 'max
(mapcar (function (lambda (x) (length (car x))))
kom-symbolic-marks-alist))))
;;; ============================================================
;;; kom-who-am-i - Vem r jag
;;;
;;; Author: David Byers
;;; ============================================================
;;; kom-who-am-i - Vem r jag
;;;
;;; Author: David Byers
(def-kom-command kom-who-am-i ()
(def-kom-command kom-who-am-i ()
"Show my name"
(interactive)
(if (and lyskom-current-conf
......@@ -1190,34 +1190,34 @@ on one line."
;;; ================================================================
;;; kom-display-who-buffer - Visa vilka-listan
;;; ================================================================
;;; kom-display-who-buffer - Visa vilka-listan
;;; Author: Linus Tolke
;;; Author: Linus Tolke
;;(def-kom-command kom-display-who-buffer ()
;; "Make the who-buffer appear on the screen as a temp buffer."
;; (interactive)
;; (let ((win (selected-window))
;; (who (display-buffer lyskom-who-info-buffer)))
;; (unwind-protect
;; (progn
;; (select-window who)
;; (if (numberp kom-who-buffer-size-when-displaying)
;; (enlarge-window (- kom-who-buffer-size-when-displaying
;; (window-height who)))))
;; (select-window win))))
;;(def-kom-command kom-display-who-buffer ()
;; "Make the who-buffer appear on the screen as a temp buffer."
;; (interactive)
;; (let ((win (selected-window))
;; (who (display-buffer lyskom-who-info-buffer)))
;; (unwind-protect
;; (progn
;; (select-window who)
;; (if (numberp kom-who-buffer-size-when-displaying)
;; (enlarge-window (- kom-who-buffer-size-when-displaying
;; (window-height who)))))
;; (select-window win))))
;;; ================================================================
;;; Hj{lp vid del av kommando - Help function
;;; ================================================================
;;; Hj{lp vid del av kommando - Help function
;;; Author: Linus Tolke
;;; Author: Linus Tolke
(defun lyskom-help ()
(defun lyskom-help ()
"Prints a short list of alternatives when you don't know what you can do."
(interactive)
(let* ((tohere (cond
......@@ -1270,7 +1270,7 @@ on one line."
(princ text)))))
(defun lyskom-help-get-keylist (keymap)
(defun lyskom-help-get-keylist (keymap)
(cond
((fboundp 'map-keymap)
(and keymap
......@@ -1296,21 +1296,21 @@ on one line."
; (setq next-char (read-char))
; (cond
; ((commandp (key-binding (concat tohere (char-to-string next-char))))
; (command-execute (concat tohere (char-to-string next-char))))
; (t (lyskom-message "%s" (lyskom-get-string 'does-not-exist))))
; (setq next-char (read-char))
; (cond
; ((commandp (key-binding (concat tohere (char-to-string next-char))))
; (command-execute (concat tohere (char-to-string next-char))))
; (t (lyskom-message "%s" (lyskom-get-string 'does-not-exist))))
;;; ================================================================
;;; [ndra livsl{ngd - Set lifespan of texts in a conference
;;; ================================================================
;;; [ndra livsl{ngd - Set lifespan of texts in a conference
;;; Author: Inge Wallin
;;; Author: Inge Wallin
(def-kom-command kom-set-garb-nice ()
(def-kom-command kom-set-garb-nice ()
"Set the garb-nice value for a conference."
(interactive)
(let ((conf-stat (lyskom-read-conf-stat
......@@ -1330,12 +1330,12 @@ on one line."
(cache-del-conf-stat (conf-stat->conf-no conf-stat)))))))
;;; ================================================================
;;; S{tt till}tna f|rfattare - set-permitted-submitters
;;; ================================================================
;;; S{tt till}tna f|rfattare - set-permitted-submitters
;;; Author: Linus Tolke
;;; Author: Linus Tolke
(def-kom-command kom-set-permitted-submitters ()
(def-kom-command kom-set-permitted-submitters ()
"Set the permitted submitters of a conference."
(interactive)
(let ((conf-stat (lyskom-read-conf-stat
......@@ -1365,13 +1365,13 @@ on one line."
(cache-del-conf-stat (conf-stat->conf-no conf-stat)))))))
;;; ================================================================
;;; [ndra superm|te - Set super conference
;;; ================================================================
;;; [ndra superm|te - Set super conference
;;; Author: Inge Wallin
;;; Author: Inge Wallin