"kbd-macros: [ (if), : (else), | (else-if), ] (end-if)"
"kbd-macros: < > (repeat), ( ) (for), { } (loop)"
"kbd-macros: / (break)"
- "kbd-macros: \\=` (save), ' (restore)")
+ "kbd-macros: \\=` (save), \\=' (restore)")
"user" ?Z))
(defun calc-hms-notation (fmt)
- (interactive "sHours-minutes-seconds format (hms, @ ' \", etc.): ")
+ (interactive "sHours-minutes-seconds format (hms, @ \\=' \", etc.): ")
(calc-wrapper
(if (string-match "\\`\\([^,; ]+\\)\\([,; ]*\\)\\([^,; ]\\)\\([,; ]*\\)\\([^,; ]\\)\\'" fmt)
(progn
(m (math-normalize (nth 2 a)))
(s (let ((calc-internal-prec (max (- calc-internal-prec 4) 3)))
(math-normalize (nth 3 a)))))
- (if (or
+ (if (or
(math-negp h)
(and (= h 0) (math-negp m))
(and (= h 0) (= m 0) (math-negp s)))
;;; A numerical date is the number of days since midnight on
;;; the morning of December 31, 1 B.C. (Gregorian) or January 2, 1 A.D. (Julian).
;;; Emacs's calendar refers to such a date as an absolute date, some Calc function
-;;; names also use that terminology. If the date is a non-integer, it represents
-;;; a specific date and time.
+;;; names also use that terminology. If the date is a non-integer, it represents
+;;; a specific date and time.
;;; A "dt" is a list of the form, (year month day), corresponding to
;;; an integer code, or (year month day hour minute second), corresponding
;;; to a non-integer code.
(defun math-date-to-gregorian-dt (date)
"Return the day (YEAR MONTH DAY) in the Gregorian calendar.
-DATE is the number of days since December 31, -1 in the Gregorian calendar."
+DATE is the number of days since December 31, -1 in the Gregorian calendar."
(let* ((month 1)
day
(year (math-quotient (math-add date (if (Math-lessp date 711859)
(setq year (math-add year -1)))
(if (eq year 0) (setq year -1))
(setq date (1+ (math-sub date temp)))
- (setq temp
+ (setq temp
(if (math-leap-year-p year)
[1 32 61 92 122 153 183 214 245 275 306 336 999]
[1 32 60 91 121 152 182 213 244 274 305 335 999]))
(defun math-date-to-julian-dt (date)
"Return the day (YEAR MONTH DAY) in the Julian calendar.
-DATE is the number of days since December 31, -1 in the Gregorian calendar."
+DATE is the number of days since December 31, -1 in the Gregorian calendar."
(let* ((month 1)
day
(year (math-quotient (math-add date (if (Math-lessp date 711859)
(setq year (math-add year -1)))
(if (eq year 0) (setq year -1))
(setq date (1+ (math-sub date temp)))
- (setq temp
+ (setq temp
(if (math-leap-year-p year t)
[1 32 61 92 122 153 183 214 245 275 306 336 999]
[1 32 60 91 121 152 182 213 244 274 305 335 999]))
(date (car parts))
(time (nth 1 parts))
(dt (if (and calc-gregorian-switch
- (Math-lessp value
+ (Math-lessp value
(or
(nth 3 calc-gregorian-switch)
(apply 'math-absolute-from-gregorian-dt calc-gregorian-switch))
(math-date-to-gregorian-dt date))))
(if (math-integerp value)
dt
- (append dt
+ (append dt
(list
(/ time 3600)
(% (/ time 60) 60)
(year (math-add approx
(let ((y approx)
(sum 0))
- (while (>= (math-compare date
+ (while (>= (math-compare date
(math-absolute-from-iso-dt (setq y (math-add y 1)) 1 1)) 0)
(setq sum (+ sum 1)))
sum))))
- (list
+ (list
year
- (math-add (car (math-idivmod
+ (math-add (car (math-idivmod
(math-sub date (math-absolute-from-iso-dt year 1 1))
7))
1)
(defun math-leap-year-p (year &optional julian)
"Non-nil if YEAR is a leap year.
If JULIAN is non-nil, then use the criterion for leap years
-in the Julian calendar, otherwise use the criterion in the
+in the Julian calendar, otherwise use the criterion in the
Gregorian calendar."
(if julian
(if (math-negp year)
in the Gregorian calendar."
(if (eq year 0) (setq year -1))
(let ((yearm1 (math-sub year 1)))
- (math-sub
+ (math-sub
;; Add the number of days of the year and the numbers of days
;; in the previous years (leap year days to be added separately)
(math-add (math-day-in-year year month day)
(math-sub 365
(math-quotient (math-sub 3 year)
4)))))
- ;; Subtract the number of Julian leap years which are not
- ;; Gregorian leap years. In C=4N+r centuries, there will
- ;; be 3N+r of these days. The following will compute
+ ;; Subtract the number of Julian leap years which are not
+ ;; Gregorian leap years. In C=4N+r centuries, there will
+ ;; be 3N+r of these days. The following will compute
;; 3N+r.
(let* ((correction (math-mul (math-quotient yearm1 100) 3))
(res (math-idivmod correction 4)))
in the Gregorian calendar."
(if (eq year 0) (setq year -1))
(let ((yearm1 (math-sub year 1)))
- (math-sub
+ (math-sub
;; Add the number of days of the year and the numbers of days
;; in the previous years (leap year days to be added separately)
(math-add (math-day-in-year year month day)
((eq x 'n)
(math-format-number (math-floor math-fd-date)))
((eq x 'J)
- (math-format-number
+ (math-format-number
(math-add math-fd-date math-julian-date-beginning)))
((eq x 'j)
- (math-format-number (math-add
- (math-floor math-fd-date)
+ (math-format-number (math-add
+ (math-floor math-fd-date)
math-julian-date-beginning-int)))
((eq x 'U)
(math-format-number (nth 1 (math-date-parts math-fd-date 719164))))
(throw 'syntax "Day value is out of range"))
(and hour
(progn
- (if (or (< hour 0)
+ (if (or (< hour 0)
(> hour 24)
(and (= hour 24)
(not (= minute 0))
(throw 'syntax "Weekday value is out of range"))
(and hour
(progn
- (if (or (< hour 0)
+ (if (or (< hour 0)
(> hour 24)
(and (= hour 24)
(not (= minute 0))
;; From cal-dst
(defvar calendar-current-time-zone-cache)
-(defvar math-calendar-tzinfo
+(defvar math-calendar-tzinfo
nil
"Information about the timezone, retrieved from the calendar.")
(if (calc-var-value 'var-TimeZone)
(calcFunc-tzone (calc-var-value 'var-TimeZone) date)
(let ((tzinfo (math-get-calendar-tzinfo)))
- (+ (nth 0 tzinfo)
+ (+ (nth 0 tzinfo)
(* (math-cal-daylight-savings-adjust date) (nth 1 tzinfo)))))))
(defvar math-daylight-savings-hook 'math-std-daylight-savings)
(+ (nth 3 dt) (/ (nth 4 dt) 60.0)))
(t
0)))
- (rounded-abs-date
- (+
+ (rounded-abs-date
+ (+
(calendar-absolute-from-gregorian
(list (nth 1 dt) (nth 2 dt) (nth 0 dt)))
(/ (round (* 60 time)) 60.0 24.0))))
(let* ((dt (math-date-to-dt date))
(dim (math-days-in-month (car dt) (nth 1 dt)))
(julian (if calc-gregorian-switch
- (math-date-to-dt (math-sub
+ (math-date-to-dt (math-sub
(or (nth 3 calc-gregorian-switch)
(apply 'math-absolute-from-gregorian-dt calc-gregorian-switch))
1)))))
(list 'date (math-dt-to-date (list (car dt) (nth 1 dt) (1+ day))))
;; Otherwise do some computations
(let ((tm (+ day (- (nth 2 calc-gregorian-switch) (nth 2 julian)))))
- (list 'date (math-dt-to-date
+ (list 'date (math-dt-to-date
(list (car dt)
(nth 1 dt)
- ;;
+ ;;
(if (> tm dim) dim tm)))))))
((and (eq (car dt) (car julian))
(= (nth 1 dt) (nth 1 julian)))
- ;; In this case, the current month is truncated because of the switch
+ ;; In this case, the current month is truncated because of the switch
;; to the Gregorian calendar
(list 'date (math-dt-to-date
(list (car dt)
(if (>= day (nth 2 julian))
(nth 2 julian)
(1+ day))))))
- (t
+ (t
;; The default
(list 'date (math-add (math-dt-to-date (list (car dt) (nth 1 dt) 1)) day))))
(list 'date (math-add (math-dt-to-date (list (car dt) (nth 1 dt) 1)) day)))))
;; Otherwise, just make sure the date doesn't go past the end of the year
(list 'date (math-min (math-add (math-dt-to-date (list (car dt) 1 1)) (1- day))
(math-dt-to-date (list (car dt) 12 31))))))
- (t
+ (t
(list 'date (math-add (math-dt-to-date (list (car dt) 1 1))
(1- day)))))
(list 'date (math-add (math-dt-to-date (list (car dt) 1 1))
'("Select, Additional, Once; eVal, Formula; Rewrite"
"More, Less, 1-9, Next, Previous"
"Unselect, Clear; Display; Enable; Breakable"
- "' (replace), \\=` (edit), +, -, *, /, RET (grab), DEL"
+ "\\=' (replace), \\=` (edit), +, -, *, /, RET (grab), DEL"
"SHIFT + swap: Left, Right; maybe: Select, Once"
"SHIFT + Commute, Merge, Distrib, jump-Eqn, Isolate"
"SHIFT + Negate, & (invert); Unpack")
"Letter keys: SHIFT + Num-eval; More-recn; eXec-kbd-macro; Keep-args"
"Other keys: +, -, *, /, ^, \\ (int div), : (frac div)"
"Other keys: & (1/x), | (concat), % (modulo), ! (factorial)"
- "Other keys: ' (alg-entry), = (eval), \\=` (edit); M-RET (last-args)"
+ "Other keys: \\=' (alg-entry), = (eval), \\=` (edit); M-RET (last-args)"
"Other keys: SPC/RET (enter/dup), LFD (over); < > (scroll horiz)"
"Other keys: DEL (drop), M-DEL (drop-above); { } (scroll vert)"
"Other keys: TAB (swap/roll-dn), M-TAB (roll-up)"
0))
(let ((msg (nth calc-help-phase msgs)))
(message "%s" (if msg
- (concat msg ":"
+ (concat (substitute-command-keys msg) ":"
(make-string (- (apply 'max
(mapcar 'length
msgs))
- (length msg)) 32)
+ (length msg))
+ ?\ )
" [?=MORE]")
""))))))))
(setq calc-display-raw (if calc-display-raw nil (if arg 0 t)))
(calc-do-refresh)
(if calc-display-raw
- (message "Press d ' again to cancel \"raw\" display mode"))))
+ (message "%s" "Press d ' again to cancel \"raw\" display mode"))))
(calc-change-mode '(calc-algebraic-mode calc-incomplete-algebraic-mode)
(list (not calc-algebraic-mode) nil)))
(use-local-map calc-mode-map)
- (message (if calc-algebraic-mode
- "Numeric keys and ( and [ begin algebraic entry"
- (if calc-incomplete-algebraic-mode
- "Only ( and [ begin algebraic entry"
- "No keys except ' and $ begin algebraic entry")))))
+ (message "%s" (if calc-algebraic-mode
+ "Numeric keys and ( and [ begin algebraic entry"
+ (if calc-incomplete-algebraic-mode
+ "Only ( and [ begin algebraic entry"
+ "No keys except ' and $ begin algebraic entry")))))
(defun calc-symbolic-mode (n)
(interactive "P")
(let ((calc-kbd-push-level 0))
(execute-kbd-macro (substring body 0 -2))))
(let ((calc-kbd-push-level (1+ calc-kbd-push-level)))
- (message "Saving modes; type Z' to restore")
+ (message "%s" "Saving modes; type Z' to restore")
(recursive-edit))))))
(defun calc-kbd-pop ()
(progn
(message "Mode settings restored")
(exit-recursive-edit))
- (error "Unbalanced Z' in keyboard macro")))
+ (error "%s" "Unbalanced Z' in keyboard macro")))
;; (defun calc-kbd-report (msg)
(defcalcmodevar calc-algebraic-mode nil
"If non-nil, numeric entry accepts whole algebraic expressions.
-If nil, algebraic expressions must be preceded by \"'\".")
+If nil, algebraic expressions must be preceded by \"\\='\".")
(defcalcmodevar calc-incomplete-algebraic-mode nil
"Like calc-algebraic-mode except only affects ( and [ keys.")
floating-point, complex, matrix, and symbolic arithmetic.
RPN calculation: 2 RET 3 + produces 5.
-Algebraic style: ' 2+3 RET produces 5.
+Algebraic style: \\=' 2+3 RET produces 5.
Basic operators are +, -, *, /, ^, & (reciprocal), % (modulo), n (change-sign).
[1 .. 4) semi-open interval, 1 <= x < 4
2 +/- 3 (p key) number with mean 2, standard deviation 3
2 mod 3 (M key) number 2 computed modulo 3
- <1 jan 91> Date form (enter using ' key)
+ <1 jan 91> Date form (enter using \\=' key)
\\{calc-mode-map}
(diary-list-entries original-date number t)))))
(display-warning
:error
- (format "Can't read included diary file %s\n" diary-file)))
+ (format-message "Can't read included diary file %s\n"
+ diary-file)))
(display-warning
:error
- (format "Can't find included diary file %s\n" diary-file)))))
+ (format-message "Can't find included diary file %s\n"
+ diary-file)))))
(goto-char (point-min)))
(defun diary-include-other-diary-files ()
(when (string= (widget-value widget) todo-item-mark)
(widget-put
widget :error
- "Invalid value: must be distinct from ‘todo-item-mark’")
+ (format-message
+ "Invalid value: must be distinct from ‘todo-item-mark’"))
widget)))
:initialize 'custom-initialize-default
:set 'todo-reset-prefix
(when (string= (widget-value widget) todo-prefix)
(widget-put
widget :error
- "Invalid value: must be distinct from ‘todo-prefix’")
+ (format-message
+ "Invalid value: must be distinct from ‘todo-prefix’"))
widget)))
:set (lambda (symbol value)
(custom-set-default symbol (propertize value 'face 'todo-mark)))
(apply 'change-log-goto-source-1
(append change-log-find-head change-log-find-tail))
(error
- (format "Cannot find more matches for tag `%s' in file `%s'"
- (car change-log-find-head)
- (nth 2 change-log-find-head)))))
+ "Cannot find more matches for tag `%s' in file `%s'"
+ (car change-log-find-head)
+ (nth 2 change-log-find-head))))
(save-excursion
(let* ((at (point))
(tag-at (change-log-search-tag-name))
(condition-case nil
(setq change-log-find-tail
(apply 'change-log-goto-source-1 change-log-find-head))
- (error
- (format "Cannot find matches for tag `%s' in file `%s'"
- tag file)))))))))
+ (error "Cannot find matches for tag `%s' in file `%s'"
+ tag file))))))))
(defun change-log-next-error (&optional argp reset)
"Move to the Nth (default 1) next match in a ChangeLog buffer.
(goto-char hunk-end))
(if modified-buffers
(message "Deleted trailing whitespace from %s."
- (mapconcat (lambda (buf) (concat "`" (buffer-name buf) "'"))
+ (mapconcat (lambda (buf) (format-message
+ "`%s'" (buffer-name buf)))
modified-buffers ", "))
(message "No trailing whitespace to delete.")))))
;; Normalize empty filter RE to nil.
(unless (> (length filter-re) 0) (setq filter-re nil))
;; Indicate progress
- (message "Comparing ‘%s’ and ‘%s’ modulo ‘%s’" d1 d2 filter-re)
+ (message "Comparing `%s' and `%s' modulo `%s'" d1 d2 filter-re)
(cond
;; D1 & D2 directories => recurse
((and (file-directory-p d1)
(aset newstr i tochar)))
newstr)))
+(unless (fboundp 'format-message)
+ (defalias 'format-message 'format))
+
(defun ediff-abbrev-jobname (jobname)
(cond ((eq jobname 'ediff-directories)
"Compare two directories")
(setq ediff-default-variant
(intern
(completing-read
- (format "Current merge default is `%S'. New default: "
- ediff-default-variant)
+ (format-message "Current merge default is `%S'. New default: "
+ ediff-default-variant)
actual-alist nil 'must-match)))
(ediff-do-merge ediff-current-difference 'remerge)
(ediff-recenter)
(with-output-to-temp-buffer ediff-msg-buffer
(ediff-with-current-buffer standard-output
(fundamental-mode))
- (princ (format
+ (princ (format-message
"Patch program has failed due to a bad patch file,
it couldn't apply all hunks, OR
it couldn't create the backup for the file being patched.
(if this-buf-n-th-diff-saved
(if (yes-or-no-p
- (format
+ (format-message
"You've previously copied diff region %d to buffer %S. Confirm? "
(1+ n) buf-type))
t
(B-line (ediff-with-current-buffer ediff-buffer-B
(1+ (count-lines (point-min) (point)))))
C-line)
- (princ (format "\Buffer A's point is on line %d\n" A-line))
- (princ (format "Buffer B's point is on line %d\n" B-line))
+ (princ (format-message "Buffer A's point is on line %d\n" A-line))
+ (princ (format-message "Buffer B's point is on line %d\n" B-line))
(if ediff-3way-job
(progn
(setq C-line (ediff-with-current-buffer ediff-buffer-C
(1+ (count-lines (point-min) (point)))))
- (princ (format "Buffer C's point is on line %d\n" C-line)))))
+ (princ (format-message
+ "Buffer C's point is on line %d\n" C-line)))))
(princ (format "\nCurrent difference number = %S\n"
(cond ((< ediff-current-difference 0) 'start)
(princ
"\nIgnoring regions that match")
(princ
- (format
+ (format-message
"\n\t regexp `%s' in buffer A %S\n\t regexp `%s' in buffer B\n"
ediff-regexp-hide-A ediff-hide-regexp-connective
ediff-regexp-hide-B)))
(princ
"\nFocusing on regions that match")
(princ
- (format
+ (format-message
"\n\t regexp `%s' in buffer A %S\n\t regexp `%s' in buffer B\n"
ediff-regexp-focus-A ediff-focus-regexp-connective
ediff-regexp-focus-B)))
(t (princ "\nSelective browsing via a user-defined method.\n")))
(princ
- (format "\nBugs/suggestions: type `%s' while in Ediff Control Panel."
- (substitute-command-keys "\\[ediff-submit-report]")))
+ (format-message
+ "\nBugs/suggestions: type `%s' while in Ediff Control Panel."
+ (substitute-command-keys "\\[ediff-submit-report]")))
) ; with output
(if (frame-live-p ediff-control-frame)
(ediff-reset-mouse ediff-control-frame))
(let (rev1 rev2)
(setq rev1
(read-string
- (format
+ (format-message
"Version 1 to merge (default %s's working version): "
(if (stringp file)
(file-name-nondirectory file) "current buffer")))
(let (rev1 rev2 ancestor-rev)
(setq rev1
(read-string
- (format
+ (format-message
"Version 1 to merge (default %s's working version): "
(if (stringp file)
(file-name-nondirectory file) "current buffer")))
(file-name-nondirectory file) "current buffer")))
ancestor-rev
(read-string
- (format
+ (format-message
"Ancestor version (default %s's base revision): "
(if (stringp file)
(file-name-nondirectory file) "current buffer"))))
The files are stored to DIR."
(interactive
(let* ((branch (cvs-prefix-get 'cvs-branch-prefix))
- (prompt (format "CVS Checkout Directory for `%s%s': "
- (cvs-get-module)
- (if branch (format " (branch: %s)" branch)
- ""))))
+ (prompt (format-message "CVS Checkout Directory for `%s%s': "
+ (cvs-get-module)
+ (if branch (format " (branch: %s)" branch)
+ ""))))
(list (read-directory-name prompt nil default-directory nil))))
(let ((modules (split-string-and-unquote (cvs-get-module)))
(flags (cvs-add-branch-prefix
(goto-char (point-min))
(looking-at ".*to add this file permanently\n\\'"))
(dolist (file (if (listp files) files (list files)))
- (insert "cvs add: scheduling file `"
- (file-name-nondirectory file)
- "' for addition\n")))
+ (insert (format-message
+ "cvs add: scheduling file `%s' for addition\n"
+ (file-name-nondirectory file)))))
;; VC never (?) does `cvs -n update' so dcd=nil
;; should probably always be the right choice.
(cvs-parse-process nil subdir))))))))
(propertize
(if (zerop (length sticky-tag))
string
- (setq help-echo (format-message "%s on the ‘%s’ branch"
+ (setq help-echo (format-message "%s on the `%s' branch"
help-echo sticky-tag))
(concat string "[" sticky-tag "]"))
'help-echo help-echo)))