File 2874-Emacs-erlang-mode-Improve-erlang-man-function-s-sear.patch of Package erlang

From b24596a35814aa4094977e76f043b3f57542140f Mon Sep 17 00:00:00 2001
From: Kjell Winblad <kjellwinblad@gmail.com>
Date: Wed, 9 Oct 2019 16:08:49 +0200
Subject: [PATCH 04/10] Emacs erlang-mode: Improve erlang-man-function's search

The Emacs lisp function erlang-man-function opens the manual page for
a module and searches within the manual page for the documentation of
the specified function. Prior to this commit, the search often failed
to find the text for the function even when the correct man page was
opened. This commit fixes this issue.
---
 lib/tools/emacs/erlang.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index 2c3ab264ab..4e30a0eaf8 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -2161,12 +2161,18 @@ command is executed asynchronously."
               (set-buffer buf)
               (goto-char (point-min))
               (if (re-search-forward
-                   (concat "^[ \t]+" func " ?(")
+                   (concat "^[ \t]*\\([a-z0-9_]*[ \t]*:\\)?[ \t]*" func "[ \t]*([A-Za-z0-9 \t:,_()]*)[ \t]*->")
                    (point-max) t)
                   (progn
                     (forward-word -1)
                     (set-window-point win (point)))
-                (message "Could not find function `%s'" func)))))))
+                (if (re-search-forward
+                     (concat "^[ \t]*\\([a-z0-9_]*[ \t]*:\\)?[ \t]*" func "[ \t]*\(")
+                     (point-max) t)
+                    (progn
+                      (forward-word -1)
+                      (set-window-point win (point)))
+                  (message "Could not find function `%s'" func))))))))
 
 (defvar erlang-man-file-regexp
   "\\(.*\\)/man[^/]*/\\([^.]+\\)\\.\\([124-9]\\|3\\(erl\\)?\\)\\(\\.gz\\)?$")
-- 
2.16.4

openSUSE Build Service is sponsored by