-
Notifications
You must be signed in to change notification settings - Fork 0
/
constellations-1.4.el
137 lines (128 loc) · 7.1 KB
/
constellations-1.4.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
;;; constellations.el --- Constellation tools.
;; Copyright 2005-2017 by Dave Pearson <davep@davep.org>
;; Author: Dave Pearson <davep@davep.org>
;; Version: 1.4
;; Keywords: convenience, astronomy
;; URL: https://github.com/davep/constellations.el
;; constellations.el is free software distributed under the terms of the GNU
;; General Public Licence, version 2. For details see the file COPYING.
;;; Commentary:
;;
;; constellations.el provides a constellation abbreviation lookup tool. I
;; can never remember the abbreviations for most constellations so, when I
;; was writing my observing logs (http://www.astronomer.me.uk/logs/) I found
;; this little tool handy -- saved me from having to remember.
;;
;; The latest constellations.el is always available from:
;;
;; <URL:https://github.com/davep/constellations.el>
;;; Code:
(defvar constellations-names '(("Andromeda" . "And")
("Antlia" . "Ant")
("Apus" . "Aps")
("Aquarius" . "Aqr")
("Aquila" . "Aql")
("Ara" . "Ara")
("Aries" . "Ari")
("Auriga" . "Aur")
("Boötes" . "Boo")
("Caelum" . "Cae")
("Camelopardalis" . "Cam")
("Cancer" . "Cnc")
("Canes Venatici" . "CVn")
("Canis Major" . "CMa")
("Canis Minor" . "CMi")
("Capricornus" . "Cap")
("Carina" . "Car")
("Cassiopeia" . "Cas")
("Centaurus" . "Cen")
("Cepheus" . "Cep")
("Cetus" . "Cet")
("Chamaeleon" . "Cha")
("Circinus" . "Cir")
("Columba" . "Col")
("Coma Berenices" . "Com")
("Corona Australis" . "CrA")
("Corona Borealis" . "CrB")
("Corvus" . "Crv")
("Crater" . "Crt")
("Crux" . "Cru")
("Cygnus" . "Cyg")
("Delphinus" . "Del")
("Dorado" . "Dor")
("Draco" . "Dra")
("Equuleus" . "Eql")
("Eridanus" . "Eri")
("Fornax" . "For")
("Gemini" . "Gem")
("Grus" . "Gru")
("Hercules" . "Her")
("Horologium" . "Hor")
("Hydra" . "Hya")
("Hydrus" . "Hyi")
("Indus" . "Ind")
("Lacerta" . "Lac")
("Leo" . "Leo")
("Leo Minor" . "LMi")
("Lepus" . "Lep")
("Libra" . "Lib")
("Lupus" . "Lup")
("Lynx" . "Lyn")
("Lyra" . "Lyr")
("Mensa" . "Men")
("Microscopium" . "Mic")
("Monoceros" . "Mon")
("Musca" . "Mus")
("Norma" . "Nor")
("Octans" . "Oct")
("Ophiuchus" . "Oph")
("Orion" . "Ori")
("Pavo" . "Pav")
("Pegasus" . "Peg")
("Perseus" . "Per")
("Phoenix" . "Phe")
("Pictor" . "Pic")
("Pisces" . "Psc")
("Piscis Austrinus" . "PsA")
("Puppis" . "Pup")
("Pyxis" . "Pyx")
("Reticulum" . "Ret")
("Sagitta" . "Sge")
("Sagittarius" . "Sgr")
("Scorpius" . "Sco")
("Sculptor" . "Scl")
("Scutum" . "Sct")
("Serpens" . "Ser")
("Sextans" . "Sex")
("Taurus" . "Tau")
("Telescopium" . "Tel")
("Triangulum" . "Tri")
("Triangulum Australe" . "TrA")
("Tucana" . "Tuc")
("Ursa Major" . "UMa")
("Ursa Minor" . "UMi")
("Vela" . "Vel")
("Virgo" . "Vir")
("Volans" . "Vol")
("Vulpecula" . "Vul"))
"List of constellations and their abbreviations.")
;;;###autoload
(defun constellations-insert-abbr (name)
"Given constellation name NAME, insert its abbreviation."
(interactive (list (completing-read "Name: " constellations-names)))
(when name
(let ((const (assoc name constellations-names)))
(when const
(insert (cdr const))))))
;;;###autoload
(defun constellations-insert-name (abbr)
"Given constellation abbreviation ABBR, insert its name."
(interactive (list (completing-read "Abbreviation: " (mapcar #'cdr constellations-names))))
(when abbr
(let ((const (assoc abbr (mapcar #'(lambda (const)
(cons (cdr const) (car const)))
constellations-names))))
(when const
(insert (cdr const))))))
(provide 'constellations)
;;; constellations.el ends here