Lines Matching +defs:po +defs:mode

0 ;;; po-mode.el -- major mode for GNU gettext PO files
36 ;; (autoload 'po-mode "po-mode"
37 ;; "Major mode for translators to edit PO files" t)
38 ;; (setq auto-mode-alist (cons '("\\.po\\'\\|\\.po\\." . po-mode)
39 ;; auto-mode-alist))
44 ;; (autoload 'po-find-file-coding-system "po-compat")
45 ;; (modify-coding-system-alist 'file "\\.po\\'\\|\\.po\\."
46 ;; 'po-find-file-coding-system)
54 (defconst po-mode-version-string "2.01" "\
55 Version number of this version of po-mode.el.")
62 ;; - XEmacs (version 19 and above) -> po-XEMACS = t,
63 ;; - GNU Emacs (version 20 and above) -> po-EMACS20 = t,
67 (setq po-EMACS20 nil po-XEMACS t))
69 (setq po-EMACS20 t po-XEMACS nil))
70 (t (setq po-EMACS20 nil po-XEMACS nil))))
96 (defgroup po nil
97 "Major mode for editing PO files"
100 (defcustom po-auto-edit-with-msgid nil
103 :group 'po)
105 (defcustom po-auto-fuzzy-on-edit nil
108 :group 'po)
110 (defcustom po-auto-select-on-unfuzzy nil
113 :group 'po)
115 (defcustom po-auto-replace-revision-date t
120 :group 'po)
122 (defcustom po-default-file-header "\
140 :group 'po)
142 (defcustom po-translation-project-address
145 Typing \\[po-send-mail] (normally bound to `M') the user will send the PO file
148 :group 'po)
150 (defcustom po-translation-project-mail-label "TP-Robot"
151 "*Subject label when sending the PO file to `po-translation-project-address'.
153 Translation Project Robot at http://www.iro.umontreal.ca/contrib/po/HTML/. If
157 :group 'po)
159 (defcustom po-highlighting (or po-EMACS20 po-XEMACS)
164 :group 'po)
166 (defcustom po-highlight-face 'highlight
167 "*The face used for PO mode highlighting. For Emacses with overlays.
174 :group 'po)
176 (defcustom po-team-name-to-code
358 :group 'po)
360 (defcustom po-gzip-uuencode-command "gzip -9 | uuencode -m"
365 :group 'po)
367 (defvar po-subedit-mode-syntax-table
368 (copy-syntax-table text-mode-syntax-table)
369 "Syntax table used while in PO mode.")
379 (fset 'po-buffer-substring
385 (fset 'po-match-string (symbol-function 'match-string-no-properties))
386 (defun po-match-string (number)
388 (po-buffer-substring (match-beginning number) (match-end number)))))
393 (fset 'po-with-temp-buffer (symbol-function 'with-temp-buffer))
395 (defmacro po-with-temp-buffer (&rest forms)
401 (generate-new-buffer-name " *po-temp*"))))
413 (fset 'po-kill-new (symbol-function 'kill-new))
415 (defun po-kill-new (string)
417 (po-with-temp-buffer
423 (fset 'po-read-event
434 ;; Handle missing 'force-mode-line-update' function.
436 (if (fboundp 'force-mode-line-update)
437 (fset 'po-force-mode-line-update
438 (symbol-function 'force-mode-line-update))
440 (defun po-force-mode-line-update ()
441 "Force the mode-line of the current buffer to be redisplayed."
448 (po-EMACS20
450 (defun po-create-overlay ()
452 The variable 'po-highlight-face' selects the face to use for highlighting."
454 (overlay-put overlay 'face po-highlight-face)
460 (defun po-highlight (overlay start end &optional buffer)
465 (defun po-rehighlight (overlay)
470 (defun po-dehighlight (overlay)
472 The current buffer should be in PO mode, when this function is called."
475 (po-XEMACS
477 (defun po-create-overlay ()
483 (set-extent-face extent po-highlight-face)
486 (defun po-highlight (extent start end &optional buffer)
491 (defun po-rehighlight (extent)
496 (defun po-dehighlight (extent)
502 (defun po-create-overlay ()
506 (defun po-highlight (overlay start end &optional buffer)
530 (defun po-rehighlight (overlay)
537 (po-highlight overlay start end buffer))))
539 (defun po-dehighlight (overlay)
570 ;; each of these variables, all meant to be local to PO mode buffers.
574 (defvar po-mode-flag)
577 ;; holds the value of the read-only flag before PO mode was entered.
578 (defvar po-read-only)
584 (defvar po-start-of-entry)
585 (defvar po-start-of-msgid)
586 (defvar po-start-of-msgstr)
587 (defvar po-end-of-entry)
588 (defvar po-entry-type)
590 ;; A few counters are usefully shown in the Emacs mode line.
591 (defvar po-translated-counter)
592 (defvar po-fuzzy-counter)
593 (defvar po-untranslated-counter)
594 (defvar po-obsolete-counter)
595 (defvar po-mode-line-string)
597 ;; PO mode keeps track of fields being edited, for one given field should
607 (defvar po-edited-fields)
610 (defvar po-marker-stack)
614 ;; its trailing slash. PO mode starts with "./" and "../".
615 (defvar po-search-path)
623 (defvar po-reference-alist)
624 (defvar po-reference-cursor)
625 (defvar po-reference-check)
635 (defvar po-keywords)
636 (defvar po-string-contents)
637 (defvar po-string-buffer)
638 (defvar po-string-start)
639 (defvar po-string-end)
640 (defvar po-marking-overlay)
643 ;;; PO mode variables and constants (usually not to customize).
647 (set-translation-domain "po-mode")
649 (defun po-mode-version ()
650 "Show Emacs PO mode version."
652 (message (_"Emacs PO mode, version %s") po-mode-version-string))
654 (defconst po-help-display-string
680 "Help page for PO mode.")
682 (defconst po-mode-menu-layout
685 ["Auto select" po-auto-select-entry
690 ["Any next" po-next-entry
693 ["Next translated" po-next-translated-entry
696 ["Next fuzzy" po-next-fuzzy-entry
699 ["Next obsolete" po-next-obsolete-entry
702 ["Next untranslated" po-next-untranslated-entry
705 ["Last file entry" po-last-entry
710 ["Any previous" po-previous-entry
713 ["Previous translated" po-previous-translated-entry
716 ["Previous fuzzy" po-previous-fuzzy-entry
719 ["Previous obsolete" po-previous-obsolete-entry
722 ["Previous untranslated" po-previous-untranslated-entry
725 ["First file entry" po-first-entry
730 ["Mark and push current" po-push-location
733 ["Pop and return" po-pop-location
736 ["Exchange current/top" po-exchange-location
740 ["Redisplay" po-current-entry
743 ["Current index" po-statistics
747 ["Undo" po-undo
752 ["Edit msgstr" po-edit-msgstr
755 ["Ediff and merge msgstr" po-edit-msgstr-and-ediff
758 ["Cut msgstr" po-kill-msgstr
761 ["Copy msgstr" po-kill-ring-save-msgstr
764 ["Paste msgstr" po-yank-msgstr
769 ["Edit comment" po-edit-comment
772 ["Ediff and merge comment" po-edit-comment-and-ediff
775 ["Cut comment" po-kill-comment
778 ["Copy comment" po-kill-ring-save-comment
781 ["Paste comment" po-yank-comment
785 ["Remove fuzzy mark" po-unfuzzy
788 ["Fuzzy or fade out" po-fade-out-entry
791 ["Init with msgid" po-msgid-to-msgstr
796 ["Other window" po-other-window
801 ["Cycle reference" po-cycle-source-reference t]
802 ["Select reference" po-select-source-reference t]
803 ["Consider path" po-consider-source-path t]
804 ["Ignore path" po-ignore-source-path t]
807 ["To compendium" po-save-entry nil]
808 ["Select, save" po-select-and-save-entry nil]
811 ["Cycle file" po-cycle-auxiliary t]
812 ["Select file" po-select-auxiliary t]
813 ["Consider file" po-consider-as-auxiliary t]
814 ["Ignore file" po-ignore-as-auxiliary t]
817 ["Lookup translation" po-lookup-lexicons nil]
818 ["Add/edit translation" po-edit-lexicon-entry nil]
819 ["Consider lexicon" po-consider-lexicon-file nil]
820 ["Ignore lexicon" po-ignore-lexicon-file nil])
823 ["Find first string" (po-tags-search '(nil)) t]
824 ["Prefer keyword" (po-select-mark-and-mark '(nil)) t]
825 ["Find next string" po-tags-search t]
826 ["Mark preferred" po-mark-translatable t]
827 ["Mark with keyword" po-select-mark-and-mark t]
829 ["Version info" po-mode-version
831 '(:help "Display version number of PO mode"))]
832 ["Help page" po-help
834 '(:help "Show the PO mode help screen"))]
835 ["Validate" po-validate
838 ["Mail officially" po-send-mail
841 ["Edit out full" po-edit-out-full
843 '(:help "Leave PO mode to edit translation file using fundamental mode"))]
845 ["Forceful quit" po-quit
848 ["Soft quit" po-confirm-and-quit
851 "Menu layout for PO mode.")
853 (defconst po-subedit-mode-menu-layout
855 ["Ediff and merge translation variants" po-subedit-ediff
858 ["Cycle through auxiliary files" po-subedit-cycle-auxiliary t]
860 ["Abort edit" po-subedit-abort
863 ["Exit edit" po-subedit-exit
866 "Menu layout for PO subedit mode.")
868 (defconst po-subedit-message
872 (defvar po-auxiliary-list nil
875 (defvar po-auxiliary-cursor nil
876 "Cursor into the 'po-auxiliary-list'.")
878 (defvar po-compose-mail-function
899 (defvar po-any-msgid-regexp
903 (defvar po-any-msgstr-regexp
908 (defvar po-msgstr-idx-keyword-regexp
912 (defvar po-msgfmt-program "msgfmt"
916 (defconst po-font-lock-keywords
930 "Additional expressions to highlight in PO mode.")
934 ;; (put 'po-mode 'font-lock-keywords 'po-font-lock-keywords))
939 ;;(if (fboundp 'hilit-set-mode-patterns)
940 ;; (hilit-set-mode-patterns 'po-mode
949 ;; Emacs 21.2 comes with po-find-file-coding-system. We give preference
951 (if (not (fboundp 'po-find-file-coding-system))
952 (require 'po-compat))
954 (defvar po-mode-abbrev-table nil
955 "Abbrev table used while in PO mode.")
956 (define-abbrev-table 'po-mode-abbrev-table ())
958 (defvar po-mode-map
960 (let ((po-mode-map (make-keymap)))
961 (suppress-keymap po-mode-map)
962 (define-key po-mode-map "\C-i" 'po-unfuzzy)
963 (define-key po-mode-map "\C-j" 'po-msgid-to-msgstr)
964 (define-key po-mode-map "\C-m" 'po-edit-msgstr)
965 (define-key po-mode-map " " 'po-auto-select-entry)
966 (define-key po-mode-map "?" 'po-help)
967 (define-key po-mode-map "#" 'po-edit-comment)
968 (define-key po-mode-map "," 'po-tags-search)
969 (define-key po-mode-map "." 'po-current-entry)
970 (define-key po-mode-map "<" 'po-first-entry)
971 (define-key po-mode-map "=" 'po-statistics)
972 (define-key po-mode-map ">" 'po-last-entry)
973 (define-key po-mode-map "a" 'po-cycle-auxiliary)
974 ;;;; (define-key po-mode-map "c" 'po-save-entry)
975 (define-key po-mode-map "f" 'po-next-fuzzy-entry)
976 (define-key po-mode-map "h" 'po-help)
977 (define-key po-mode-map "k" 'po-kill-msgstr)
978 ;;;; (define-key po-mode-map "l" 'po-lookup-lexicons)
979 (define-key po-mode-map "m" 'po-push-location)
980 (define-key po-mode-map "n" 'po-next-entry)
981 (define-key po-mode-map "o" 'po-next-obsolete-entry)
982 (define-key po-mode-map "p" 'po-previous-entry)
983 (define-key po-mode-map "q" 'po-confirm-and-quit)
984 (define-key po-mode-map "r" 'po-pop-location)
985 (define-key po-mode-map "s" 'po-cycle-source-reference)
986 (define-key po-mode-map "t" 'po-next-translated-entry)
987 (define-key po-mode-map "u" 'po-next-untranslated-entry)
988 (define-key po-mode-map "v" 'po-mode-version)
989 (define-key po-mode-map "w" 'po-kill-ring-save-msgstr)
990 (define-key po-mode-map "x" 'po-exchange-location)
991 (define-key po-mode-map "y" 'po-yank-msgstr)
992 (define-key po-mode-map "A" 'po-consider-as-auxiliary)
993 (define-key po-mode-map "E" 'po-edit-out-full)
994 (define-key po-mode-map "F" 'po-previous-fuzzy-entry)
995 (define-key po-mode-map "K" 'po-kill-comment)
996 ;;;; (define-key po-mode-map "L" 'po-consider-lexicon-file)
997 (define-key po-mode-map "M" 'po-send-mail)
998 (define-key po-mode-map "O" 'po-previous-obsolete-entry)
999 (define-key po-mode-map "T" 'po-previous-translated-entry)
1000 (define-key po-mode-map "U" 'po-previous-untranslated-entry)
1001 (define-key po-mode-map "Q" 'po-quit)
1002 (define-key po-mode-map "S" 'po-consider-source-path)
1003 (define-key po-mode-map "V" 'po-validate)
1004 (define-key po-mode-map "W" 'po-kill-ring-save-comment)
1005 (define-key po-mode-map "Y" 'po-yank-comment)
1006 (define-key po-mode-map "_" 'po-undo)
1007 (define-key po-mode-map "0" 'po-other-window)
1008 (define-key po-mode-map "\177" 'po-fade-out-entry)
1009 (define-key po-mode-map "\C-c\C-a" 'po-select-auxiliary)
1010 (define-key po-mode-map "\C-c\C-e" 'po-edit-msgstr-and-ediff)
1011 (define-key po-mode-map [?\C-c?\C-#] 'po-edit-comment-and-ediff)
1012 (define-key po-mode-map "\C-c\C-C" 'po-edit-comment-and-ediff)
1013 (define-key po-mode-map "\M-," 'po-mark-translatable)
1014 (define-key po-mode-map "\M-." 'po-select-mark-and-mark)
1015 ;;;; (define-key po-mode-map "\M-c" 'po-select-and-save-entry)
1016 ;;;; (define-key po-mode-map "\M-l" 'po-edit-lexicon-entry)
1017 (define-key po-mode-map "\M-s" 'po-select-source-reference)
1018 (define-key po-mode-map "\M-A" 'po-ignore-as-auxiliary)
1019 ;;;; (define-key po-mode-map "\M-L" 'po-ignore-lexicon-file)
1020 (define-key po-mode-map "\M-S" 'po-ignore-source-path)
1021 po-mode-map)
1022 "Keymap for PO mode.")
1024 (defun po-mode ()
1025 "Major mode for translators when they edit PO files.
1028 \\{po-mode-map}
1029 Turning on PO mode calls the value of the variable 'po-mode-hook',
1034 (setq major-mode 'po-mode
1035 mode-name "PO")
1036 (use-local-map po-mode-map)
1039 (easy-menu-define po-mode-menu po-mode-map "" po-mode-menu-layout)
1040 (and po-XEMACS (easy-menu-add po-mode-menu))))
1041 (set (make-local-variable 'font-lock-defaults) '(po-font-lock-keywords t))
1043 (set (make-local-variable 'po-read-only) buffer-read-only)
1046 (make-local-variable 'po-start-of-entry)
1047 (make-local-variable 'po-start-of-msgid)
1048 (make-local-variable 'po-start-of-msgstr)
1049 (make-local-variable 'po-end-of-entry)
1050 (make-local-variable 'po-entry-type)
1052 (make-local-variable 'po-translated-counter)
1053 (make-local-variable 'po-fuzzy-counter)
1054 (make-local-variable 'po-untranslated-counter)
1055 (make-local-variable 'po-obsolete-counter)
1056 (make-local-variable 'po-mode-line-string)
1058 (setq po-mode-flag t)
1060 (po-check-file-header)
1061 (po-compute-counters nil)
1063 (set (make-local-variable 'po-edited-fields) nil)
1064 (set (make-local-variable 'po-marker-stack) nil)
1065 (set (make-local-variable 'po-search-path) '(("./") ("../")))
1067 (set (make-local-variable 'po-reference-alist) nil)
1068 (set (make-local-variable 'po-reference-cursor) nil)
1069 (set (make-local-variable 'po-reference-check) 0)
1071 (set (make-local-variable 'po-keywords)
1073 (set (make-local-variable 'po-string-contents) nil)
1074 (set (make-local-variable 'po-string-buffer) nil)
1075 (set (make-local-variable 'po-string-start) nil)
1076 (set (make-local-variable 'po-string-end) nil)
1077 (set (make-local-variable 'po-marking-overlay) (po-create-overlay))
1079 (add-hook 'write-contents-hooks 'po-replace-revision-date)
1081 (run-hooks 'po-mode-hook)
1082 (message (_"You may type 'h' or '?' for a short PO mode reminder.")))
1084 (defvar po-subedit-mode-map
1086 (let ((po-subedit-mode-map (make-keymap)))
1087 (define-key po-subedit-mode-map "\C-c\C-a" 'po-subedit-cycle-auxiliary)
1088 (define-key po-subedit-mode-map "\C-c\C-c" 'po-subedit-exit)
1089 (define-key po-subedit-mode-map "\C-c\C-e" 'po-subedit-ediff)
1090 (define-key po-subedit-mode-map "\C-c\C-k" 'po-subedit-abort)
1091 po-subedit-mode-map)
1092 "Keymap while editing a PO mode entry (or the full PO file).")
1097 (make-variable-buffer-local 'po-mode-flag)
1099 (defvar po-mode-line-entry '(po-mode-flag (" " po-mode-line-string))
1102 ;; Insert MODE-LINE-ENTRY in mode line, but on first load only.
1103 (or (member po-mode-line-entry mode-line-format)
1104 ;; mode-line-format usually contains global-mode-string, but some
1106 (let ((prev-entry (or (member 'global-mode-string mode-line-format)
1107 (member " " mode-line-format)
1108 (last mode-line-format))))
1109 (setcdr prev-entry (cons po-mode-line-entry (cdr prev-entry)))))
1111 (defun po-update-mode-line-string ()
1112 "Compute a new statistics string to display in mode line."
1113 (setq po-mode-line-string
1114 (concat (format "%dt" po-translated-counter)
1115 (if (> po-fuzzy-counter 0)
1116 (format "+%df" po-fuzzy-counter))
1117 (if (> po-untranslated-counter 0)
1118 (format "+%du" po-untranslated-counter))
1119 (if (> po-obsolete-counter 0)
1120 (format "+%do" po-obsolete-counter))))
1121 (po-force-mode-line-update))
1123 (defun po-type-counter ()
1125 (cond ((eq po-entry-type 'obsolete) 'po-obsolete-counter)
1126 ((eq po-entry-type 'fuzzy) 'po-fuzzy-counter)
1127 ((eq po-entry-type 'translated) 'po-translated-counter)
1128 ((eq po-entry-type 'untranslated) 'po-untranslated-counter)
1131 (defun po-decrease-type-counter ()
1133 (let ((counter (po-type-counter)))
1136 (defun po-increase-type-counter ()
1138 Then, update the mode line counters."
1139 (let ((counter (po-type-counter)))
1141 (po-update-mode-line-string))
1144 (defvar po-fuzzy-regexp)
1145 (defvar po-untranslated-regexp)
1147 (defun po-compute-counters (flag)
1148 "Prepare counters for mode line display. If FLAG, also echo entry position."
1149 (and flag (po-find-span-of-entry))
1150 (setq po-translated-counter 0
1151 po-fuzzy-counter 0
1152 po-untranslated-counter 0
1153 po-obsolete-counter 0)
1157 (po-find-span-of-entry)
1158 (setq current po-start-of-msgstr)
1161 (po-find-span-of-entry)
1162 (if (string-equal (po-get-msgid nil) "")
1163 (goto-char po-end-of-entry))
1167 (while (re-search-forward po-any-msgstr-regexp nil t)
1177 (setq po-obsolete-counter (1+ po-obsolete-counter)))
1178 ((looking-at po-untranslated-regexp)
1179 (setq po-untranslated-counter (1+ po-untranslated-counter)))
1180 (t (setq po-translated-counter (1+ po-translated-counter))))
1187 (while (re-search-forward po-fuzzy-regexp nil t)
1188 (setq po-fuzzy-counter (1+ po-fuzzy-counter)))
1189 (setq po-translated-counter (- po-translated-counter po-fuzzy-counter)))
1196 position total po-translated-counter po-fuzzy-counter
1197 po-untranslated-counter po-obsolete-counter)
1199 (po-update-mode-line-string))
1201 (defun po-redisplay ()
1207 (goto-char po-start-of-msgid))
1209 (defun po-other-window ()
1210 "Get the cursor into another window, out of PO mode."
1221 (defun po-check-file-header ()
1222 "Create a missing PO mode file header, or replace an oldish one."
1224 (let ((buffer-read-only po-read-only)
1227 (if (re-search-forward po-any-msgstr-regexp nil t)
1253 (insert po-default-file-header)
1257 (defun po-replace-revision-date ()
1260 (if (or (eq po-auto-replace-revision-date t)
1261 (and (eq po-auto-replace-revision-date 'ask)
1266 (let* ((buffer-read-only po-read-only)
1285 (defun po-find-span-of-entry ()
1291 (if (re-search-backward po-any-msgstr-regexp nil t)
1297 (re-search-forward po-any-msgstr-regexp)
1303 (setq po-start-of-entry (match-end 0))
1307 (setq po-start-of-msgstr (match-beginning 0)
1308 po-end-of-entry (match-end 0))
1309 (if (re-search-forward po-any-msgstr-regexp nil t)
1312 (setq po-start-of-msgstr (match-beginning 0)
1313 po-end-of-entry (match-end 0)))
1317 (goto-char po-start-of-msgstr)
1318 (setq po-start-of-entry
1319 (if (re-search-backward po-any-msgstr-regexp nil t)
1323 (setq po-start-of-msgstr (match-beginning 0)
1324 po-end-of-entry (match-end 0))
1327 (goto-char po-start-of-msgstr)
1328 (setq po-start-of-entry
1329 (if (re-search-backward po-any-msgstr-regexp nil t)
1333 (setq po-start-of-entry (point-min))
1334 (goto-char po-start-of-entry)
1336 (re-search-forward po-any-msgstr-regexp)
1337 (setq po-start-of-msgstr (match-beginning 0)
1338 po-end-of-entry (match-end 0)))
1340 (goto-char po-start-of-entry)
1341 (re-search-forward po-any-msgid-regexp)
1342 (setq po-start-of-msgid (match-beginning 0))
1344 (setq po-entry-type
1347 (goto-char po-start-of-entry)
1348 (if (re-search-forward po-fuzzy-regexp po-start-of-msgid t)
1350 (goto-char po-start-of-msgstr)
1351 (if (looking-at po-untranslated-regexp)
1357 (defun po-add-attribute (name)
1360 (let ((buffer-read-only po-read-only))
1361 (goto-char po-start-of-entry)
1362 (if (re-search-forward "\n#[,!] .*" po-start-of-msgid t)
1375 (defun po-delete-attribute (name)
1378 (let ((buffer-read-only po-read-only))
1379 (goto-char po-start-of-entry)
1380 (if (re-search-forward "\n#[,!] .*" po-start-of-msgid t)
1392 (defun po-say-location-depth ()
1394 (let ((depth (length po-marker-stack)))
1399 (defun po-push-location ()
1402 (po-find-span-of-entry)
1404 (goto-char po-start-of-msgid)
1405 (setq po-marker-stack (cons (point-marker) po-marker-stack)))
1406 (po-say-location-depth))
1408 (defun po-pop-location ()
1411 (if po-marker-stack
1413 (goto-char (car po-marker-stack))
1414 (setq po-marker-stack (cdr po-marker-stack))
1415 (po-current-entry)
1416 (po-say-location-depth))
1419 (defun po-exchange-location ()
1422 (if po-marker-stack
1424 (po-find-span-of-entry)
1425 (goto-char po-start-of-msgid)
1427 (goto-char (car po-marker-stack))
1428 (setq po-marker-stack (cons location (cdr po-marker-stack))))
1429 (po-current-entry)
1430 (po-say-location-depth))
1433 (defun po-current-entry ()
1436 (po-find-span-of-entry)
1437 (po-redisplay))
1439 (defun po-first-entry-with-regexp (regexp)
1446 (po-current-entry))
1450 (defun po-last-entry-with-regexp (regexp)
1455 (po-current-entry)
1459 (defun po-next-entry-with-regexp (regexp wrap)
1462 (po-find-span-of-entry)
1464 (goto-char po-end-of-entry)
1468 (po-current-entry))
1472 (re-search-forward regexp po-start-of-entry t)))
1475 (po-current-entry)
1480 (defun po-previous-entry-with-regexp (regexp wrap)
1483 (po-find-span-of-entry)
1485 (goto-char po-start-of-entry)
1487 (po-current-entry)
1491 (re-search-backward regexp po-end-of-entry t)))
1493 (po-current-entry)
1500 (defun po-first-entry ()
1503 (po-first-entry-with-regexp po-any-msgstr-regexp))
1505 (defun po-last-entry ()
1508 (po-last-entry-with-regexp po-any-msgstr-regexp))
1510 (defun po-next-entry ()
1513 (po-next-entry-with-regexp po-any-msgstr-regexp nil))
1515 (defun po-previous-entry ()
1518 (po-previous-entry-with-regexp po-any-msgstr-regexp nil))
1522 (defvar po-after-entry-regexp
1526 (defvar po-untranslated-regexp
1527 (concat "^msgstr[ \t]*\"\"\n" po-after-entry-regexp)
1530 (defun po-next-untranslated-entry ()
1533 (po-next-entry-with-regexp po-untranslated-regexp t))
1535 (defun po-previous-untranslated-entry ()
1538 (po-previous-entry-with-regexp po-untranslated-regexp t))
1540 (defun po-msgid-to-msgstr ()
1543 (po-find-span-of-entry)
1544 (if (or (eq po-entry-type 'untranslated)
1545 (eq po-entry-type 'obsolete)
1547 (po-set-msgstr (po-get-msgid nil)))
1552 (defvar po-obsolete-msgstr-regexp
1556 (defun po-next-obsolete-entry ()
1559 (po-next-entry-with-regexp po-obsolete-msgstr-regexp t))
1561 (defun po-previous-obsolete-entry ()
1564 (po-previous-entry-with-regexp po-obsolete-msgstr-regexp t))
1568 (defvar po-fuzzy-regexp "^#[,!] .*fuzzy"
1572 (defun po-next-fuzzy-entry ()
1575 (po-next-entry-with-regexp po-fuzzy-regexp t))
1577 (defun po-previous-fuzzy-entry ()
1580 (po-previous-entry-with-regexp po-fuzzy-regexp t))
1582 (defun po-unfuzzy ()
1585 (po-find-span-of-entry)
1586 (cond ((eq po-entry-type 'fuzzy)
1587 (po-decrease-type-counter)
1588 (po-delete-attribute "fuzzy")
1589 (po-current-entry)
1590 (po-increase-type-counter)))
1591 (if po-auto-select-on-unfuzzy
1592 (po-auto-select-entry))
1593 (po-update-mode-line-string))
1597 (defun po-next-translated-entry ()
1600 (if (= po-translated-counter 0)
1602 (po-next-entry-with-regexp po-any-msgstr-regexp t)
1603 (po-find-span-of-entry)
1604 (while (not (eq po-entry-type 'translated))
1605 (po-next-entry-with-regexp po-any-msgstr-regexp t)
1606 (po-find-span-of-entry))))
1608 (defun po-previous-translated-entry ()
1611 (if (= po-translated-counter 0)
1613 (po-previous-entry-with-regexp po-any-msgstr-regexp t)
1614 (po-find-span-of-entry)
1615 (while (not (eq po-entry-type 'translated))
1616 (po-previous-entry-with-regexp po-untranslated-regexp t)
1617 (po-find-span-of-entry))))
1621 (defun po-auto-select-entry ()
1628 (po-find-span-of-entry)
1629 (goto-char po-end-of-entry)
1630 (if (and (= po-untranslated-counter 0)
1631 (= po-fuzzy-counter 0)
1632 (= po-obsolete-counter 0))
1635 (if (re-search-forward po-any-msgstr-regexp nil t)
1640 (let ((goal (if (eq po-entry-type 'translated)
1642 po-entry-type)))
1646 (if (and (> po-untranslated-counter 0)
1647 (re-search-forward po-untranslated-regexp nil t))
1655 (if (and (> po-fuzzy-counter 0)
1656 (re-search-forward po-fuzzy-regexp nil t))
1664 (if (and (> po-obsolete-counter 0)
1665 (re-search-forward po-obsolete-msgstr-regexp nil t))
1672 (po-current-entry))
1677 (defun po-extract-unquoted (buffer start end)
1687 (po-extract-part-unquoted buffer start end))
1689 (defun po-extract-part-unquoted (buffer start end)
1692 (po-with-temp-buffer
1720 (defun po-eval-requoted (form prefix obsolete)
1726 (po-with-temp-buffer
1761 (defun po-get-msgid (kill)
1764 (let ((string (po-extract-unquoted (current-buffer)
1765 po-start-of-msgid po-start-of-msgstr)))
1766 (if kill (po-kill-new string))
1769 (defun po-get-msgstr (kill)
1772 (let ((string (po-extract-unquoted (current-buffer)
1773 po-start-of-msgstr po-end-of-entry)))
1774 (if kill (po-kill-new string))
1777 (defun po-set-msgid (form)
1785 (let ((string (po-eval-requoted form "msgid" (eq po-entry-type 'obsolete))))
1787 (goto-char po-start-of-entry)
1788 (re-search-forward po-any-msgid-regexp po-start-of-msgstr)
1789 (and (not (string-equal (po-match-string 0) string))
1790 (let ((buffer-read-only po-read-only))
1792 (goto-char po-start-of-msgid)
1793 (po-find-span-of-entry)
1796 (defun po-set-msgstr (form)
1804 (let ((string (po-eval-requoted form "msgstr" (eq po-entry-type 'obsolete)))
1807 (goto-char po-start-of-entry)
1809 (if (re-search-forward po-msgstr-idx-keyword-regexp
1810 po-end-of-entry t)
1813 (re-search-forward po-any-msgstr-regexp po-end-of-entry)
1814 (and (not (string-equal (po-match-string 0) string))
1815 (let ((buffer-read-only po-read-only))
1816 (po-decrease-type-counter)
1824 (goto-char po-start-of-msgid)
1825 (po-find-span-of-entry)
1826 (po-increase-type-counter)
1829 (defun po-kill-ring-save-msgstr ()
1832 (po-find-span-of-entry)
1833 (po-get-msgstr t))
1835 (defun po-kill-msgstr ()
1838 (po-kill-ring-save-msgstr)
1839 (po-set-msgstr ""))
1841 (defun po-yank-msgstr ()
1844 (po-find-span-of-entry)
1845 (po-set-msgstr (if (eq last-command 'yank) '(yank-pop 1) '(yank)))
1848 (defun po-fade-out-entry ()
1852 (po-find-span-of-entry)
1854 (cond ((eq po-entry-type 'translated)
1855 (po-decrease-type-counter)
1856 (po-add-attribute "fuzzy")
1857 (po-current-entry)
1858 (po-increase-type-counter))
1860 ((or (eq po-entry-type 'fuzzy)
1861 (eq po-entry-type 'untranslated))
1864 (po-decrease-type-counter)
1867 (narrow-to-region po-start-of-entry po-end-of-entry)
1868 (let ((buffer-read-only po-read-only))
1874 (po-current-entry)
1875 (po-increase-type-counter)))
1878 ((and (eq po-entry-type 'obsolete)
1879 (po-check-for-pending-edit po-start-of-msgid)
1880 (po-check-for-pending-edit po-start-of-msgstr))
1881 (po-decrease-type-counter)
1882 (po-update-mode-line-string)
1883 (po-get-msgstr t)
1884 (let ((buffer-read-only po-read-only))
1885 (delete-region po-start-of-entry po-end-of-entry))
1886 (goto-char po-start-of-entry)
1887 (if (re-search-forward po-any-msgstr-regexp nil t)
1889 (re-search-backward po-any-msgstr-regexp nil t))
1890 (po-current-entry)
1896 (defvar po-active-comment-regexp
1900 (defvar po-obsolete-comment-regexp
1904 (defun po-get-comment (kill-flag)
1908 (obsolete (eq po-entry-type 'obsolete)))
1910 (goto-char po-start-of-entry)
1911 (if (re-search-forward (if obsolete po-obsolete-comment-regexp
1912 po-active-comment-regexp)
1913 po-end-of-entry t)
1914 (po-with-temp-buffer
1925 (defun po-set-comment (form)
1930 (let ((obsolete (eq po-entry-type 'obsolete))
1932 (po-with-temp-buffer
1946 (goto-char po-start-of-entry)
1948 (if obsolete po-obsolete-comment-regexp po-active-comment-regexp)
1949 po-end-of-entry t)
1950 (if (not (string-equal (po-match-string 0) string))
1951 (let ((buffer-read-only po-read-only))
1954 (let ((buffer-read-only po-read-only))
1956 (po-current-entry))
1958 (defun po-kill-ring-save-comment ()
1961 (po-find-span-of-entry)
1962 (po-get-comment t))
1964 (defun po-kill-comment ()
1967 (po-kill-ring-save-comment)
1968 (po-set-comment "")
1969 (po-redisplay))
1971 (defun po-yank-comment ()
1974 (po-find-span-of-entry)
1975 (po-set-comment (if (eq last-command 'yank) '(yank-pop 1) '(yank)))
1977 (po-redisplay))
1986 (defvar po-subedit-back-pointer)
1988 (defun po-clean-out-killed-edits ()
1990 (let ((cursor po-edited-fields))
1997 (and overlay (po-dehighlight overlay)))
1998 (setq po-edited-fields (delete slot po-edited-fields)))))))
2000 (defun po-check-all-pending-edits ()
2002 (po-clean-out-killed-edits)
2003 (or (null po-edited-fields)
2004 (let ((slot (car po-edited-fields)))
2008 (and overlay (po-rehighlight overlay)))
2009 (message po-subedit-message)
2012 (defun po-check-for-pending-edit (position)
2014 (po-clean-out-killed-edits)
2017 (let ((slot (assoc marker po-edited-fields)))
2023 (and overlay (po-rehighlight overlay)))
2024 (message po-subedit-message)))
2027 (defun po-edit-out-full ()
2028 "Get out of PO mode, leaving PO file buffer in fundamental mode."
2030 (if (and (po-check-all-pending-edits)
2033 (setq buffer-read-only po-read-only)
2034 (fundamental-mode)
2035 (message (_"Type 'M-x po-mode RET' once done")))))
2037 (defun po-ediff-quit ()
2045 (define-key ediff-mode-map "Q" 'po-ediff-quit)))
2047 (defun po-ediff-buffers-exit-recursive (b1 b2 oldbuf end)
2054 For more info cf. `po-subedit-ediff'."
2063 (defun po-subedit-ediff ()
2065 `po-subedit-ediff' calls `po-ediff-buffers-exit-recursive' to edit translation
2076 `recursive-edit', or call \\[po-ediff-quit] (`Q') in the ediff control panel."
2079 (buf1 " *po-msgstr-1") ; default if first marker is missing
2081 (back-pointer po-subedit-back-pointer)
2116 (po-ediff-buffers-exit-recursive buf1 buf2 oldbuf end-2)
2121 (defun po-subedit-abort ()
2125 (back-pointer po-subedit-back-pointer)
2134 (and overlay-info (po-dehighlight overlay-info))
2136 (setq po-edited-fields (delete back-pointer po-edited-fields)))))
2138 (defun po-subedit-exit ()
2145 (run-hooks 'po-subedit-exit-hook)
2147 (po-subedit-abort)
2148 (po-find-span-of-entry)
2149 (cond ((= (point) po-start-of-msgid)
2150 (po-set-comment string)
2151 (po-redisplay))
2152 ((= (point) po-start-of-msgstr)
2153 (let ((replaced (po-set-msgstr string)))
2155 po-auto-fuzzy-on-edit
2156 (eq po-entry-type 'translated))
2158 (po-decrease-type-counter)
2159 (po-add-attribute "fuzzy")
2160 (po-current-entry)
2161 (po-increase-type-counter)))))
2164 (defun po-edit-string (string type expand-tabs)
2167 Run functions on po-subedit-mode-hook."
2169 (set-marker marker (cond ((eq type 'comment) po-start-of-msgid)
2170 ((eq type 'msgstr) po-start-of-msgstr)))
2171 (if (po-check-for-pending-edit marker)
2177 (if (and (eq type 'msgstr) po-highlighting)
2179 ;; (goto-char (1- po-start-of-msgstr))
2182 (goto-char po-start-of-entry)
2183 (re-search-forward po-any-msgid-regexp nil t)
2187 (setq overlay (po-create-overlay))
2188 (po-highlight overlay (point) end buffer))))
2190 po-edited-fields (cons slot po-edited-fields))
2192 (set (make-local-variable 'po-subedit-back-pointer) slot)
2196 (setq local-abbrev-table po-mode-abbrev-table)
2200 (and expand-tabs (setq indent-tabs-mode nil))
2201 (use-local-map po-subedit-mode-map)
2204 (easy-menu-define po-subedit-mode-menu po-subedit-mode-map ""
2205 po-subedit-mode-menu-layout)
2206 (and po-XEMACS (easy-menu-add po-subedit-mode-menu))))
2207 (set-syntax-table po-subedit-mode-syntax-table)
2208 (run-hooks 'po-subedit-mode-hook)
2209 (message po-subedit-message)))))
2211 (defun po-edit-comment ()
2214 (po-find-span-of-entry)
2215 (po-edit-string (po-get-comment nil) 'comment nil))
2217 (defun po-edit-comment-and-ediff ()
2219 This function calls `po-edit-msgstr' and `po-subedit-ediff'; for more info
2220 read `po-subedit-ediff' documentation."
2222 (po-edit-comment)
2223 (po-subedit-ediff))
2225 (defun po-edit-msgstr ()
2228 (po-find-span-of-entry)
2229 (po-edit-string (if (and po-auto-edit-with-msgid
2230 (eq po-entry-type 'untranslated))
2231 (po-get-msgid nil)
2232 (po-get-msgstr nil))
2236 (defun po-edit-msgstr-and-ediff ()
2238 This function calls `po-edit-msgstr' and `po-subedit-ediff'; for more info
2239 read `po-subedit-ediff' documentation."
2241 (po-edit-msgstr)
2242 (po-subedit-ediff))
2247 (defun po-normalize-old-style (explain)
2252 (buffer-read-only po-read-only))
2265 (defun po-normalize-field (field explain)
2271 (while (re-search-forward po-any-msgstr-regexp nil t)
2275 (po-find-span-of-entry)
2276 (cond ((eq field 'msgid) (po-set-msgid (po-get-msgid nil)))
2277 ((eq field 'msgstr) (po-set-msgstr (po-get-msgstr nil))))
2278 (goto-char po-end-of-entry)
2284 (defsubst po-normalise () (po-normalize))
2286 (defun po-normalize ()
2289 (po-normalize-old-style (_"pass 1/3"))
2290 (po-normalize-field t (_"pass 2/3"))
2291 (po-normalize-field nil (_"pass 3/3"))
2293 (if (not (= po-end-of-entry (point-max)))
2294 (let ((buffer-read-only po-read-only))
2295 (kill-region po-end-of-entry (point-max))))
2298 (po-compute-counters nil))
2303 (defun po-show-auxiliary-list ()
2305 (if po-auxiliary-list
2306 (let ((cursor po-auxiliary-cursor)
2311 (setq cursor po-auxiliary-list)
2312 (while (not (eq cursor po-auxiliary-cursor))
2318 (defun po-consider-as-auxiliary ()
2321 (if (member (list buffer-file-name) po-auxiliary-list)
2323 (setq po-auxiliary-list
2324 (nconc po-auxiliary-list (list (list buffer-file-name))))
2325 (or po-auxiliary-cursor
2326 (setq po-auxiliary-cursor po-auxiliary-list)))
2327 (po-show-auxiliary-list))
2329 (defun po-ignore-as-auxiliary ()
2332 (setq po-auxiliary-list (delete (list buffer-file-name) po-auxiliary-list)
2333 po-auxiliary-cursor po-auxiliary-list)
2334 (po-show-auxiliary-list))
2336 (defun po-seek-equivalent-translation (name string)
2352 (po-find-span-of-entry)
2355 (buffer-substring po-start-of-msgstr po-end-of-entry)
2361 (po-find-span-of-entry)
2362 (if po-highlighting
2364 (goto-char po-start-of-entry)
2365 (re-search-forward po-any-msgstr-regexp nil t)
2370 (po-highlight po-marking-overlay (point) end))))
2371 (goto-char po-start-of-msgid))
2373 (po-find-span-of-entry)
2377 (defun po-cycle-auxiliary ()
2380 (po-find-span-of-entry)
2381 (if po-auxiliary-list
2382 (let ((string (buffer-substring po-start-of-msgid po-start-of-msgstr))
2383 (cursor po-auxiliary-cursor)
2388 (po-seek-equivalent-translation name string))
2390 po-auxiliary-cursor cursor))
2392 (setq cursor po-auxiliary-list)
2396 (po-seek-equivalent-translation name string))
2398 po-auxiliary-cursor cursor))
2403 (defun po-subedit-cycle-auxiliary ()
2406 (let* ((entry-marker (nth 0 po-subedit-back-pointer))
2410 (po-cycle-auxiliary)
2413 (defun po-select-auxiliary ()
2418 (po-find-span-of-entry)
2419 (if po-auxiliary-list
2420 (let ((string (buffer-substring po-start-of-msgid po-start-of-msgstr))
2422 po-auxiliary-list nil t)
2423 po-auxiliary-list))))
2424 (po-consider-as-auxiliary)
2425 (or (po-seek-equivalent-translation name string)
2431 (defun po-show-source-path ()
2433 (if po-search-path
2434 (let ((cursor po-search-path)
2442 (defun po-consider-source-path (directory)
2445 (setq po-search-path (cons (list (if (string-match "/$" directory)
2448 po-search-path))
2449 (setq po-reference-check 0)
2450 (po-show-source-path))
2452 (defun po-ignore-source-path ()
2455 (setq po-search-path
2457 po-search-path nil t))
2458 po-search-path))
2459 (setq po-reference-check 0)
2460 (po-show-source-path))
2462 (defun po-ensure-source-references ()
2464 (po-find-span-of-entry)
2465 (if (= po-start-of-entry po-reference-check)
2467 (setq po-reference-alist nil)
2469 (goto-char po-start-of-entry)
2470 (if (re-search-forward "^#:" po-start-of-msgid t)
2474 (setq name (po-match-string 2)
2475 line (po-match-string 3)
2476 path po-search-path)
2485 (setq po-reference-alist
2489 po-reference-alist)))))))
2490 (setq po-reference-alist (nreverse po-reference-alist)
2491 po-reference-cursor po-reference-alist
2492 po-reference-check po-start-of-entry)))
2494 (defun po-show-source-context (triplet)
2501 (cursor po-reference-alist))
2506 po-reference-cursor cursor)
2512 (defun po-cycle-source-reference ()
2516 (po-ensure-source-references)
2517 (if po-reference-cursor
2518 (po-show-source-context
2519 (car (if (eq last-command 'po-cycle-source-reference)
2520 (or (cdr po-reference-cursor) po-reference-alist)
2521 po-reference-cursor)))
2524 (defun po-select-source-reference ()
2527 (po-ensure-source-references)
2528 (if po-reference-alist
2529 (po-show-source-context
2531 (completing-read (_"Which source context? ") po-reference-alist nil t)
2532 po-reference-alist))
2543 (defvar po-find-string-function)
2544 (defvar po-mark-string-function)
2546 ;; Dynamically set within po-tags-search for po-tags-loop-operate.
2547 (defvar po-current-po-buffer)
2548 (defvar po-current-po-keywords)
2550 (defun po-tags-search (restart)
2557 (if po-highlighting
2558 (po-dehighlight po-marking-overlay))
2559 (setq po-string-contents nil)
2561 (let ((po-current-po-buffer (current-buffer))
2562 (po-current-po-keywords po-keywords))
2563 (pop-to-buffer po-string-buffer)
2565 (eq (car tags-loop-operate) 'po-tags-loop-operate))
2566 ;; Continue last po-tags-search.
2568 ;; Start or restart po-tags-search all over.
2569 (setq tags-loop-scan '(po-tags-loop-scan)
2570 tags-loop-operate '(po-tags-loop-operate))
2572 (select-window (get-buffer-window po-current-po-buffer)))
2573 (if po-string-contents
2575 (buffer po-string-buffer)
2576 (start po-string-start)
2577 (end po-string-end))
2589 (and po-highlighting
2590 (po-highlight po-marking-overlay start end buffer)))))
2592 (defun po-tags-loop-scan ()
2593 "Decide if the current buffer is still interesting for PO mode strings."
2594 ;; We have little choice, here. The major mode is needed to dispatch to the
2596 ;; tags module to revisit files fully. po-tags-loop-operate sets point at
2600 (defun po-tags-loop-operate ()
2601 "Find an acceptable tag in the current buffer, according to mode.
2603 (po-preset-string-functions)
2607 (setq data (apply po-find-string-function po-current-po-keywords nil))
2610 (po-with-temp-buffer
2632 (set-buffer po-current-po-buffer)
2633 (setq po-string-contents (nth 0 data)
2634 po-string-buffer buffer
2635 po-string-start (nth 1 data)
2636 po-string-end (nth 2 data))))
2641 (defun po-mark-found-string (keyword)
2643 (if (not po-string-contents)
2645 (and po-highlighting (po-dehighlight po-marking-overlay))
2646 (let ((contents po-string-contents)
2647 (buffer po-string-buffer)
2648 (start po-string-start)
2649 (end po-string-end)
2655 (apply po-mark-string-function start end keyword nil))
2657 (let ((buffer-read-only po-read-only))
2660 (buffer-file-name po-string-buffer)
2663 (insert (po-eval-requoted contents "msgid" nil) "msgstr \"\"\n"))
2664 (setq po-untranslated-counter (1+ po-untranslated-counter))
2665 (po-update-mode-line-string))
2666 (setq po-string-contents nil)))
2668 (defun po-mark-translatable ()
2671 (po-mark-found-string "_"))
2673 (defun po-select-mark-and-mark (arg)
2680 (setq po-keywords (cons keyword (delete keyword po-keywords))))
2681 (or po-string-contents (error (_"No such string")))
2682 (let* ((default (car (car po-keywords)))
2685 po-keywords nil t )))
2687 (po-mark-found-string keyword))))
2690 ;;; Unknown mode specifics.
2692 (defun po-preset-string-functions ()
2693 "Preset FIND-STRING-FUNCTION and MARK-STRING-FUNCTION according to mode.
2695 (let ((pair (cond ((string-equal mode-name "AWK")
2696 '(po-find-awk-string . po-mark-awk-string))
2697 ((member mode-name '("C" "C++"))
2698 '(po-find-c-string . po-mark-c-string))
2699 ((string-equal mode-name "Emacs-Lisp")
2700 '(po-find-emacs-lisp-string . po-mark-emacs-lisp-string))
2701 ((string-equal mode-name "Python")
2702 '(po-find-python-string . po-mark-python-string))
2703 ((and (string-equal mode-name "Shell-script")
2704 (string-equal mode-line-process "[bash]"))
2705 '(po-find-bash-string . po-mark-bash-string))
2706 (t '(po-find-unknown-string . po-mark-unknown-string)))))
2707 (or (boundp 'po-find-string-function)
2708 (set (make-local-variable 'po-find-string-function) (car pair)))
2709 (or (boundp 'po-mark-string-function)
2710 (set (make-local-variable 'po-mark-string-function) (cdr pair)))))
2712 (defun po-find-unknown-string (keywords)
2716 (defun po-mark-unknown-string (start end keyword)
2721 ;;; Awk mode specifics.
2723 (defun po-find-awk-string (keywords)
2758 (if (member (list (po-buffer-substring
2765 (list (po-extract-unquoted (current-buffer) start end) start end))))
2767 (defun po-mark-awk-string (start end keyword)
2782 ;;; Bash mode specifics.
2784 (defun po-find-bash-string (keywords)
2815 (list (po-extract-unquoted (current-buffer) start end) start end))))
2817 (defun po-mark-bash-string (start end keyword)
2825 ;;; C or C++ mode specifics.
2845 (defun po-find-c-string (keywords)
2886 (if (member (list (po-buffer-substring (point)
2900 (list (po-extract-unquoted (current-buffer) start end) start end))))
2902 (defun po-mark-c-string (start end keyword)
2914 ;;; Emacs LISP mode specifics.
2916 (defun po-find-emacs-lisp-string (keywords)
2941 (member (list (po-buffer-substring (point)
2951 (list (po-extract-unquoted (current-buffer) start end) start end))))
2953 (defun po-mark-emacs-lisp-string (start end keyword)
2964 ;;; Python mode specifics.
2966 (defun po-find-python-string (keywords)
2979 (po-skip-over-python-string))
2982 (po-skip-over-python-string))
2988 contents (po-skip-over-python-string)
3001 (if (member (list (po-buffer-substring (point)
3010 (defun po-skip-over-python-string ()
3071 (po-extract-part-unquoted (current-buffer)
3076 (defun po-mark-python-string (start end keyword)
3096 (defun po-help ()
3097 "Provide an help window for PO mode."
3099 (po-with-temp-buffer
3100 (insert po-help-display-string)
3106 (po-read-event))))
3108 (defun po-undo ()
3111 (let ((buffer-read-only po-read-only))
3113 (po-compute-counters nil))
3115 (defun po-statistics ()
3118 (po-compute-counters t))
3120 (defun po-validate ()
3128 (function (lambda (mode-name)
3129 (concat "*" mode-name " validation*"))))
3130 (compile-command (concat po-msgfmt-program
3133 (po-msgfmt-version-check)
3136 (defvar po-msgfmt-version-checked nil)
3137 (defun po-msgfmt-version-check ()
3139 (po-with-temp-buffer
3142 po-msgfmt-version-checked
3147 (call-process po-msgfmt-program
3167 (setq po-msgfmt-version-checked t))
3171 (defun po-guess-archive-name ()
3178 (re-search-forward po-any-msgstr-regexp)
3186 (setq package (po-match-string 2)
3187 version (po-match-string 3)))
3193 (string-match "^[^\\.]*\\.po\\'" filename))
3194 (;; TP Robot compatible `filename': PACKAGE-VERSION.LL.po
3196 "-\\(.*\\)\\.[^\\.]*\\.po\\'") filename)
3197 (if (not (equal version (po-match-string 1 filename)))
3201 (po-match-string 1 filename) version))))
3203 (if (stringp po-team-name-to-code)
3204 (setq team po-team-name-to-code)
3209 (let ((name (po-match-string 1)))
3211 (let ((pair (assoc name po-team-name-to-code)))
3220 (concat package "-" version "." team ".po"))))
3222 (defun po-guess-team-address ()
3227 (re-search-forward po-any-msgstr-regexp)
3232 (setq team (po-match-string 2)))
3235 (po-match-string 1))))
3237 (defun po-send-mail ()
3244 (po-guess-team-address)
3245 po-translation-project-address)))
3247 (apply po-compose-mail-function address
3252 (or (zerop po-untranslated-counter)
3255 po-untranslated-counter)))
3256 (or (zerop po-fuzzy-counter)
3259 po-fuzzy-counter)))
3260 (or (zerop po-obsolete-counter)
3263 po-obsolete-counter))))
3265 (name (po-guess-archive-name))
3266 (transient-mark-mode nil)
3269 (apply po-compose-mail-function address
3272 (format "%s %s" po-translation-project-mail-label name))
3281 (concat po-gzip-uuencode-command " " name ".gz") t))))))
3284 (defun po-confirm-and-quit ()
3288 (if (po-check-all-pending-edits)
3291 (> po-untranslated-counter 0)
3292 (> po-fuzzy-counter 0)
3293 (> po-obsolete-counter 0)
3295 (po-quit))
3298 (defun po-quit ()
3303 (if (po-check-all-pending-edits)
3311 (po-validate)
3314 ;; might be asynchronous with PO mode commands, the safest is to
3315 ;; stay within PO mode, even if this implies that another
3316 ;; 'po-quit' command will be later required to exit for true.
3320 (or (> po-untranslated-counter 0)
3321 (> po-fuzzy-counter 0)
3322 (> po-obsolete-counter 0))
3327 (po-auto-select-entry)))
3336 (provide 'po-mode)
3338 ;;; po-mode.el ends here