Function: ethio-process-language-flag

ethio-process-language-flag is a byte-compiled function defined in ethio-util.el.gz.

Signature

(ethio-process-language-flag)

Documentation

Process a language flag of the form "~lang" or "~lang1~lang2".

If looking at "~lang1~lang2", set ethio-primary-language and ethio-secondary-language based on "lang1" and "lang2". Then delete the language flag "~lang1~lang2" from the buffer. Return value is the new primary language.

If looking at "~lang", delete that language flag "~lang" from the buffer and return that language. In this case ethio-primary-language and ethio-secondary-language are left unchanged.

If an unsupported language flag is found, just return nil without changing anything.

Source Code

;; Defined in /usr/src/emacs/lisp/language/ethio-util.el.gz
(defun ethio-process-language-flag nil
  "Process a language flag of the form \"~lang\" or \"~lang1~lang2\".

If looking at \"~lang1~lang2\", set `ethio-primary-language' and
`ethio-secondary-language' based on \"lang1\" and \"lang2\".
Then delete the language flag \"~lang1~lang2\" from the buffer.
Return value is the new primary language.

If looking at \"~lang\", delete that language flag \"~lang\" from
the buffer and return that language.  In this case
`ethio-primary-language' and `ethio-secondary-language' are left
unchanged.

If an unsupported language flag is found, just return nil without
changing anything."

  (let (lang1 lang2)
    (cond

     ;; ~lang1~lang2
     ((and (looking-at
	    "~\\([a-z][a-z][a-z]?\\)~\\([a-z][a-z][a-z]?\\)[ \t\n\\]")
	   (setq lang1 (ethio-flag-to-language (match-string 1)))
	   (setq lang2 (ethio-flag-to-language (match-string 2))))
      (setq ethio-primary-language lang1
	    ethio-secondary-language lang2)
      (delete-region (point) (match-end 2))
      (if (= (following-char) 32)
	  (delete-char 1))
      ethio-primary-language)

     ;; ~lang
     ((and (looking-at "~\\([a-z][a-z][a-z]?\\)[ \t\n\\]")
	   (setq lang1 (ethio-flag-to-language (match-string 1))))
      (delete-region (point) (match-end 1))
      (if (= (following-char) 32)
	  (delete-char 1))
      lang1)

     ;; otherwise
     (t
      nil))))