emms-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emms-help] line-number-at-pos - not available in XEmacs 21.4p19


From: Adam Sjøgren
Subject: [emms-help] line-number-at-pos - not available in XEmacs 21.4p19
Date: Fri, 21 Apr 2006 00:12:46 +0200
User-agent: Gnus/5.110005 (No Gnus v0.5) XEmacs/21.4.19 (linux)

  Hi.


After some help on #emacs I got EMMS running with my mpd-equipped
server.

I had to add a compability function for line-number-at-pos because it
is not present in the XEmacs I got installed (21.4p19 from
Debian/unstable).

The function is used in emms-player-mpd.el and emms-streams.el.

So, please consider including something similar to the attached :-)


  Best regards & thanks for EMMS!

    Adam

-- 
 "Yakka foob mog. Grug pubbawup zink wattoom gazork.          Adam Sjøgren
  Chumble spuzz."                                        address@hidden

--- old-emms/emms.el    2006-04-21 00:11:26.243653975 +0200
+++ new-emms/emms.el    2006-04-21 00:11:26.250654138 +0200
@@ -1165,5 +1165,22 @@
                 text (replace-match replacement fixedcase literal text))))
       text)))
 
+;; Taken from 
<http://cvs.xemacs.org/viewcvs.cgi/XEmacs/xemacs/lisp/simple.el?rev=1.54&content-type=text/vnd.viewcvs-markup>:
+(unless (fboundp 'line-number-at-pos)
+  (defun line-number (&optional pos respect-narrowing)
+    "Return the line number of POS (defaults to point).
+If RESPECT-NARROWING is non-nil, then the narrowed line number is returned;
+otherwise, the absolute line number is returned.  The returned line can always
+be given to `goto-line' to get back to the current line."
+    (if (and pos (/= pos (point)))
+        (save-excursion
+          (goto-char pos)
+          (line-number nil respect-narrowing))
+      (1+ (count-lines (if respect-narrowing (point-min) 1) (point-at-bol)))))
+
+  ;; FSF 22.0.50.1 (CVS) version of above.
+  (defun line-number-at-pos (&optional pos)
+    (line-number pos t)))
+
 (provide 'emms)
 ;;; emms.el ends here


reply via email to

[Prev in Thread] Current Thread [Next in Thread]