aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2023-02-26 07:33:09 +0800
committerPo Lu2023-02-26 07:33:09 +0800
commit687f4fadde4fda8a320cbb4e26518af1034cbb9a (patch)
tree058f134955de00d7a98d50df8d9db8dca531b77f
parent8fa86cc7cd708fae8657b4e977711132999054bc (diff)
parente91d29f0048d49c4f186e76b8d55cf39e7e77d63 (diff)
downloademacs-687f4fadde4fda8a320cbb4e26518af1034cbb9a.tar.gz
emacs-687f4fadde4fda8a320cbb4e26518af1034cbb9a.zip
Merge remote-tracking branch 'origin/master' into feature/android
-rw-r--r--lisp/calendar/lunar.el19
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el13
2 files changed, 19 insertions, 13 deletions
diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el
index 4f8f34d954f..5b22043102d 100644
--- a/lisp/calendar/lunar.el
+++ b/lisp/calendar/lunar.el
@@ -245,10 +245,11 @@ use instead of point."
245 (insert 245 (insert
246 (mapconcat 246 (mapconcat
247 (lambda (x) 247 (lambda (x)
248 (format "%s: %s %s %s" (calendar-date-string (car x)) 248 (let ((eclipse (nth 3 x)))
249 (lunar-phase-name (nth 2 x)) 249 (concat (calendar-date-string (car x)) ": "
250 (cadr x) 250 (lunar-phase-name (nth 2 x)) " "
251 (car (last x)))) 251 (cadr x) (unless (string-empty-p eclipse) " ")
252 eclipse)))
252 (lunar-phase-list m1 y1) "\n"))) 253 (lunar-phase-list m1 y1) "\n")))
253 (message "Computing phases of the moon...done")))) 254 (message "Computing phases of the moon...done"))))
254 255
@@ -283,9 +284,13 @@ use when highlighting the day in the calendar."
283 (while (calendar-date-compare phase (list date)) 284 (while (calendar-date-compare phase (list date))
284 (setq index (1+ index) 285 (setq index (1+ index)
285 phase (lunar-phase index))) 286 phase (lunar-phase index)))
286 (if (calendar-date-equal (car phase) date) 287 (and (calendar-date-equal (car phase) date)
287 (cons mark (concat (lunar-phase-name (nth 2 phase)) " " 288 (cons mark
288 (cadr phase)))))) 289 (let ((eclipse (nth 3 phase)))
290 (concat (lunar-phase-name (nth 2 phase)) " "
291 (cadr phase)
292 (unless (string-empty-p eclipse) " ")
293 eclipse))))))
289 294
290;; For the Chinese calendar the calculations for the new moon need to be more 295;; For the Chinese calendar the calculations for the new moon need to be more
291;; accurate than those above, so we use more terms in the approximation. 296;; accurate than those above, so we use more terms in the approximation.
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 4b0a714e52d..00abe730948 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -886,19 +886,20 @@ byte-compiled. Run with dynamic binding."
886 ;; Should not warn that mt--test2 is not known to be defined. 886 ;; Should not warn that mt--test2 is not known to be defined.
887 (should-not (re-search-forward "my--test2" nil t)))) 887 (should-not (re-search-forward "my--test2" nil t))))
888 888
889(defmacro bytecomp--with-warning-test (re-warning form) 889(defun bytecomp--with-warning-test (re-warning form)
890 (declare (indent 1)) 890 (declare (indent 1))
891 `(with-current-buffer (get-buffer-create "*Compile-Log*") 891 `(bytecomp--with-warning-test-1 ,re-warning ,form))
892(defun bytecomp--with-warning-test-1 (re-warning form)
893 (with-current-buffer (get-buffer-create "*Compile-Log*")
892 (let ((inhibit-read-only t)) (erase-buffer)) 894 (let ((inhibit-read-only t)) (erase-buffer))
893 (let ((text-quoting-style 'grave) 895 (let ((text-quoting-style 'grave)
894 (macroexp--warned 896 (macroexp--warned ; oh dear
895 (make-hash-table :test #'equal :weakness 'key)) ; oh dear 897 (make-hash-table :test #'equal :weakness 'key)))
896 (form ,form))
897 (ert-info ((prin1-to-string form) :prefix "form: ") 898 (ert-info ((prin1-to-string form) :prefix "form: ")
898 (byte-compile form) 899 (byte-compile form)
899 (ert-info ((prin1-to-string (buffer-string)) :prefix "buffer: ") 900 (ert-info ((prin1-to-string (buffer-string)) :prefix "buffer: ")
900 (should (re-search-forward 901 (should (re-search-forward
901 (string-replace " " "[ \n]+" ,re-warning)))))))) 902 (string-replace " " "[ \n]+" re-warning))))))))
902 903
903(ert-deftest bytecomp-warn-wrong-args () 904(ert-deftest bytecomp-warn-wrong-args ()
904 (bytecomp--with-warning-test "remq.*3.*2" 905 (bytecomp--with-warning-test "remq.*3.*2"