[logaling-commit] logaling/logalimacs [master] loga-return-word-on-cursor: Apply including quate string (ain't etc..)

Back to archive index

Yuta Yamada null+****@clear*****
Sat Aug 11 18:01:08 JST 2012


Yuta Yamada	2012-08-11 18:01:08 +0900 (Sat, 11 Aug 2012)

  New Revision: 617b7298a709226b8c88f43d233a65c456ee113f
  https://github.com/logaling/logalimacs/commit/617b7298a709226b8c88f43d233a65c456ee113f

  Log:
    loga-return-word-on-cursor: Apply including quate string (ain't etc..)

  Modified files:
    logalimacs.el

  Modified: logalimacs.el (+16 -5)
===================================================================
--- logalimacs.el    2012-08-09 19:58:33 +0900 (0ffb21b)
+++ logalimacs.el    2012-08-11 18:01:08 +0900 (dad27ff)
@@ -573,15 +573,26 @@ Otherwise passed character inside region."
 (defun loga-return-word-on-cursor ()
   "Return word where point on cursor."
   (save-excursion
-    (let ((match-word
-           (if (looking-at "\\w")
-               (word-at-point)
-             (backward-word)
-             (word-at-point))))
+    (let ((match-word (loga-word-at-point)))
       (if (string-match "[上-黑]" match-word)
           (loga-reject-hiragana match-word)
         match-word))))
 
+(defun loga-word-at-point ()
+  (if (looking-at "[ \n]")
+      (skip-chars-backward " "))
+  (loga-skip :backward)
+  (set-mark-command nil)
+  (loga-skip :forward)
+  (buffer-substring-no-properties
+   (region-beginning) (region-end)))
+
+(defun loga-skip (direction)
+  (let ((skip-characters "a-zA-Zぁ-んァ-ン上-黑'"))
+    (case direction
+      (:forward  (skip-chars-forward  skip-characters))
+      (:backward (skip-chars-backward skip-characters)))))
+
 (defun loga-reject-hiragana (string)
   (replace-regexp-in-string "[ぁ-ん]" "" string))
 
-------------- next part --------------
An HTML attachment was scrubbed...
Descargar 



More information about the logaling-commit mailing list
Back to archive index