Donlin M. Long, a pioneering neurosurgeon whose brain research helped millions of patients manage pain and who collaborated on the invention of an implantable pump to deliver insulin to people with diabetes, died on Sept. 19 near Gettysburg, Pa. He was 89.

The cause was complications of a fall he suffered while fly-fishing for trout in a stream near his weekend home, his daughter Dr. Kimberly Page Riley said. Dr. Long was a resident of North Baltimore and chairman of the neurosurgery department at Johns Hopkins University for 17 years.

In addition to the insulin pump, Dr. Long, as an expert in relieving chronic pain, had a collaborative hand in introducing, in 1981, the first battery-powered, rechargeable, implantable electronic device to stimulate peripheral nerves to relieve pain, according to Johns Hopkins. The device, known as TENS, for transcutaneous electrical nerve stimulator, became a standard medical tool.

As an accomplished practitioner of skull base surgery, Dr. Long was also instrumental in the first successful separation of twin infants born conjoined at the head. The operation, performed in 1987, involved 70 surgeons, nurses and assistants and lasted 22 hours.

The twins’ brains were separated, and one of the infants’ skulls was closed by Dr. Benjamin S. Carson, whom Dr. Long, the founding chairman of the department of neurosurgery at Johns Hopkins University in Baltimore, had recruited to the university. The operation, at Johns Hopkins Hospital, brought Dr. Carson instant fame. He was later a Republican presidential candidate and secretary of the Department of Housing and Urban Development under President Donald J. Trump.

Dr. Long, Dr. Carson’s mentor, closed the other boy’s skull during the operation.

Drs. Long and Carson had just one hour to accomplish final separation, to reconstruct the divided brain cavities and veins, and to restart the hearts in the infants, both of them boys.

Dr. Patrick J. Connolly, the chief of neurosurgery at Virtua Mount Holly Hospital in New Jersey and a professor at the Perelman School of Medicine at the University of Pennsylvania, hailed Dr. Long’s contributions to neurosurgery as well as to two other specialties, the treatment of vascular and spinal diseases.

“We use steroids to treat brain edema every day in neurosurgery thanks to Dr. Long’s research in the early ’70s,” he said, “and his contribution to spinal cord stimulation has permitted relief of suffering for millions of people over the last 50 or so years.”

When Dr. Long arrived at Johns Hopkins in 1973, the neurosurgery department had only five full time surgeons, performing some 125 surgeries a year. By the time he retired in 2000, the full-time staff had more than doubled and the number of operations had soared to more than 3,500 annually, performed at Johns Hopkins Hospital and Johns Hopkins Bayview Medical Center.

He was instrumental in Johns Hopkins’ decision to erect the Adolf Meyer Center in 1981, uniting the departments of neurosurgery, neurology and psychiatry in one building and facilitating collaboration among them.

Dr. Long’s research into chronic pain prepared him to help design the transcutaneous electrical nerve stimulator at Johns Hopkins. Later in the 1980s, he collaborated with colleagues at the Johns Hopkins Applied Physics Laboratory to invent the implantable medication pump to treat diabetic patients.

Many of the surgeons trained during Dr. Long’s tenure at Johns Hopkins were hired as full professors, as leaders of neurosurgery departments at hospitals and universities, and as heads of professional associations.

“Neurosurgeons everywhere stand on his shoulders,” Dr. Connolly said.

Donlin Martin Long Jr. was born on April 14, 1934, in Rolla, Mo., in the southwest Ozarks. He was a descendant of New England Quakers, one of whom, according to a Johns Hopkins biography, had blazed a trail through the Cumberland Gap in the Appalachians alongside Daniel Boone. His father, Donlin Sr., was a chemist for the state health department. His mother, Davine (Johnson) Long, was a teacher.

Raised in Jefferson City, Mo., Dr. Long earned undergraduate and medical degrees, in 1955 and 1959, from the University of Missouri. He received a doctorate in neuroanatomy in 1964 from the University of Minnesota, where he had planned to become a cardiac surgeon before changing course and focusing on neurosurgery, inspired by the work of Dr. Lyle A. French in that field.

As residents at Minnesota, he and Joseph Galicich conducted research that led to the use of steroids to reduce postoperative brain swelling.

Dr. Long told The New York Times in 1987 that “chronic pain is the weakest area of modern medicine and the least well managed of any complaint or disease.”

He is survived by his wife, Harriett (Kallenbach) Long; another daughter, Elisabeth Merchant Long; a son, David; and four grandchildren. His three children have all taught or worked as administrators at Johns Hopkins.

Remembered for his equanimity, his role as a mentor and his can-do passion, Dr. Long often told his children and grandchildren, “There is no try, only did and did not.”

Bernard Mokam contributed reporting.